Jump to main content Jump to doc navigation
Note: This document is a stub, please help by expanding it.

MODX ships with the concept of Lexicons to aid with internationalisation (i18n). They are key => value pairs, per language, that can be accessed in a variety of ways.

Relevant settings

For proper i18n support, configure the following settings:

  • For the manager, set the manager_language setting to the 2 character language code.
  • For the frontend:
    • Set the cultureKey setting to the 2 character language code to indicate what lexicon should be loaded.
    • Set the locale setting to the full locale (e.g. de_DE.UTF8) to use the locale for time/date/number formats, among other things.


Lexicon topics need to be loaded before they can be used.

Using Lexicons in templates

[[%key? &topic=`topicname` &namespace=`namespace_name` &language=`en`]]

Using Lexicons in PHP

echo $modx->lexicon('key');

Building a multi lingual site

To build multi-lingual sites, there are typically 2 approaches you can take in MODX.

The first involves setting up a context per language. You route the visitor to the right context by (sub)domain or subfolder using a gateway plugin, virtual host, or third party extra like xRouting or LangRouter.

With the multi-context approach, the Babel third party extra can be useful to connect translations across contexts. You can also use lexicons in your templates with different contexts, by creating the appropriate cultureKey and locale context settings.

Another approach is to manage all languages from a single context. This requires third party extras, like Lingua.

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.



$0 per month—let's make that $500!

Learn more