Setup multiple languages

You can set up your site so that you can edit the content of your pages in different languages or locales.


The installation of new locales is an easy job to do.
Open your config/initializers/maglev.rb file and start adding the following lines:
Maglev.configure do |config|
config.default_site_locales = [
{ label: 'English', prefix: 'en' },
{ label: 'French', prefix: 'fr' }
Save this file and run the following command to apply those changes:
$ bundle exec rails maglev:change_site_locales
Finally, restart your Rails server.
Once it's done, go to the editor UI and you should see a locale picker like the one in the screenshot below.


The multi-languages functionality comes with several rules:
  • the title, path, sections content and seo information attributes of a page can be translated.
  • each translation of the page is independent. For instance, a page A in the EN locale can have different sections compared to its version in the FR locale.
  • the default locale is the first locale of the site.
  • when previewing a page in the default locale, the path of the page won't include the locale. Example:
  • when previewing a page in a local different from the default one, the page of the page will include the locale prefix. Example: