Skip to content

MODX Globalization for Multiple Languages

MODX is an open source Content Management System (CMS) based on PHP programming language and it supports both Microsoft MSSQL and MySQL databases. MODx was introduced in 2004, and in 2010, MODX Revolution was released with a completely new structure. The cloud version entered the market a couple of years later.

In this blog, I will discuss the features that allow for MODx globalization in order to handle multiple languages.

MODX Globalization and Localization
  • MODX uses the term “Lexicons” to refer to Globalization (g11n).
  • Lexicon is a collection of Topics and Entries.
  • Lexicon Topic = a set of Entries.
  • Lexicon Entry = single language pair key/value.
  • Administration module (MODX Manager) is shipped with a built-in tool for string localization.
  • Front end (context(s)) have no built-in tool for localization.
How MODX Handles Multiple Languages
Content Management Systems always use one of two approaches to handle multiple languages:
  1. The page in the source language has multiple versions per language and is saved on a database using a unique page ID linked to the parent page (source language). Ex: EPiServer and Sitecore.
  2. Use a separate section per language. For example, a home page in English needs to be physically duplicated and assigned a group of settings to handle a different language. (Each CMS has its own step by step process for handling this approach).

MODX follows the second approach. This approach has certain challenges, but following the CMS steps carefully will guarantee a strong structure that can handle multiple languages without issues.

Challenges include:
  • Additional time and effort needed if there are multiple languages, as all the steps will need to be repeated per language.
  • A technical background is needed in order to set language locales and some programming code snippet to handle the way the CMS will detect and display languages based on the client selection or the browser settings.
MODX Globalization Best Practices

The CMS needs to first be structured by adding Context per language. MODX uses Context to set each language separately. Admins can create any number of Contexts, one per language. See images below for further information:



Each Context must have a basic group of settings in order to enable Multilanguage. The following settings are mandatory:
  • Base URL
  • Culture Key
  • Site Start
  • Site URL



Once the above steps are done, a PHP developer must add a routine of code to retrieve the current culture key and switch to the correct Context based on that:



In this blog I briefly explained the MODX CMS structure and the different approaches that CMSs follow to handle multiple languages. Finally, I detailed the best practice steps to globalize MODX in order to handle multiple languages.