Globalizing Mephisto (Part 4)

Welcome to the fourth part of the Globalizing Mephisto article series which shows you how to enable the definition of the active locale via a path parameter rather than via subdomains.

When I first posted about the mephisto_i18n plugin on the mephisto forum some people mentioned that they thought using subdomains to define the active locale wasn’t very handy, especially for mephisto instances on shared hosts.

In response to that feedback, I’ve now updated the plugin to allow locale definition either via:

  • subdomains (default)
  • path parameter

Using the ‘path parameter’ mode means you can have urls like this:


Enabling path parameter mode in 3 easy steps

Update environment.rb

Add the following line to your environment file:

Mephisto::I18N.locale_definition = :path

Update routes.rb

Replace the call to:

Mephisto::Routing.connect_with map

Mephisto::I18N::Routing.connect_with map
in your routes file.

Update your liquid templates (optional)

Optionally, modify any hard-coded links in your liquid templates like so:


<a href="/{{'blog' | t: 'urls'}}">{{'Weblog' | t}}</a>

<a href="{{i18n.l}}/{{'blog' | t: 'urls'}}">{{'Weblog' | t}}</a>

NOTE: This assumes you’ve already installed the plugin for a single site or multi site globalized mephisto.

What has been done for you automatically…

When in path parameter mode and the active locale is not the base locale then:

  • The plugin automatically rewrites urls generated via the url_rewriter which means that all links using link_to and family are automatically correctly localized.
  • The article/section & site urls (tag/search) are automatically prepended with the correct language code which means most of the links of your site will just work.

Please do try out this mode and, as usual, I appreciate your feedback.

Saimon Moore (also in Greek, Spanish & Catalan :)

14 comments on “Globalizing Mephisto (Part 4)”

  1. Lukasz Nowak

    Hi, I’d like to know is it polish version of mephisto? If not could we translate mephisto?

  2. Kinderspiele

    Great articles! Thanks a lot.

  3. izmir web tasarım

    Thanks for this useful article

  4. ht
  5. sepetli platform

    Thanks for this article and most generaly for this very amazing website :) this information most important for me.

  6. Spielen Kostenlos

    Great Thx!

  7. Bundle Handy

    Great articles! Thanks a lot.

  8. Flirt

    It works great, good job and thanks a lot.

  9. Muskelaufbau-Ernä

    Thanks for this really useful article. Best Regards from germany

  10. essay help

    Just want to add that after getting the translation, walk through the website with the translator to make sure it’s REALLY right. Sometimes things translate differently when the context changes. I also noticed that some special characters sometimes got mixed up, so this is a good opportunity to spot those.

  11. dora
  12. kennenlernen
  13. Catering

    This is exactly what i was searching for, thanks a lot!

  14. Carl Partnersuche

    Looked for hours for this information, before i stumbled upon your side.. :-) Thanks a lot!

Leave your comment