Language Handling in CMS Made Simple


CMS Made Simple is a content management system designed and built for managing websites that display information in a single language. CMS Made Simple's admin interface allows each user to choose a suitable language in which they can operate CMSMS. CMSMS works on the premise that on a single page request only information from a single language will be displayed. i.e: you will not be displaying English text, dates and numbers, followed by the same information in another language on the same page.

CMSMS is not built out of the box to allow building websites where multiple translations of the same content are supported. However, there are third party addon solutions to this problem, and CMSMS provides powerful tools to make working with languages, and detecting languages simpler.

The CMSMS Core, full package ships with basic information about numerous languages. This includes NLS information which tells the system about the aliases for a specific language, the encoding of that language, its direction (left to right, or right to left), and some default locale settings. It also includes community submitted translation strings for the admin interface, and for the core modules. The translation strings allow important strings to be presented in the desired language.

The CMSMS Core 'english' package ships with only information about the English language. As well, there are numerous language packages (langpacks) that are available to allow adding information about selected individual languages to a CMSMS installation.

CMSMS provides API's for retrieving a translated string, for setting and getting a 'current' language, and for retrieving information about the language settings. Additionally some plugins are included with CMSMS for similar tasks, and for finding out which languages the current users browser supports. All of these utilities can be used to assist in building websites where the correct display of information is language dependent.

Translation Strings

The CMSMS core admin interface, and core modules have been translated by the community to various languages. This allows the admin interface to be used in numerous languages by customers and end users. The use of translation strings on the frontend by the core is limited to prompts for forms, and prompts for various links. i.e: such as the 'next page' link in and the category and author prompts in the default News templates. Third party modules may make further use of translation strings on frontend requests. The CMSMS admin interface is completely dependent upon translation strings.


The "locale" information is used for formatting numbers and dates. Locales are server dependent. if the server does not have any information about a locale, then there is no way that CMSMS can 'switch' to that locale. i.e: on most English based servers, it is not possible to display dates and numbers in the French format (with French month names etc). without first installing French locale information on the server. This is a task that is outside of CMSMS's realm of control.

Admin Requests

When CMSMS begins to handle a request for the CMSMS admin interface (including the login page) it does various things in order to attempt to create a suitable localized environment for the user:

  1. Detect a suitable language
    1. The system checks user's preferred default language preference. If it has been set, and the nls information exists for that language, it is used.
    2. Next CMSMS checks what languages the users browser says it supports, and cross references those with the available languages. If a match is found, it is used.
    3. Lastly, if no match can be found, en_US is assumed.
  2. Set the locale

    The language information shipped with CMSMS includes some suitable locale settings for most languages. Once a language has been selected the system will set the locale so that numbers and dates can be formatted in a locale specific way.

  3. Encodings

    The encoding name associated with the language that has been selected is used when sending information from the server to the users browser.

Frontend Request

When CMSMS begins to handle a request for the CMSMS frontend it takes a slightly different path for detecting a language:

  1. language detection:
    1. If a 'language detector object' has been set into the CMSMS language API's a third party tool can be used to select a language. That third party tool may use information from the requested URL, data stored in the browser, data stored in the session, a cookie or some other data. However, the language returned must be known by CMSMS.
    2. If no language detector is set, then the site preference "Default Language for the Frontend" is used.
    3. If still no language can be found, en_US is assumed.
  2. The locale is set given the language information shipped with CMSMS.
  3. Encodings

    The encoding name associated with the language that has been selected is used when sending information from the server to the users browser.

Smarty plugins

CMSMS provides a few plugins to assist with language manipulation. They are outlined below. For more precise help on usage of these plugins go to Extensions >> Tags in the admin console.

  • cms_get_language tag

    This plugin retrieves the current language that CMSMS is configured for.

  • cms_set_language

    This plugin can be used to set the current CMSMS language, along with the associated locale and encoding. CMSMS must have the NLS information for the selected language for this to succeed.

  • cms_lang_info tag

    Returns an object containing the information CMSMS knows about the current (or specified) language.

Special Behavior

The following section outlines special behavior of CMSMS with regard to languages, and also how the behavior can be manipulated in various ways.

  1. Config Entries
    1. 'locale':

      The $config['locale'] entry in the config.php can be used to override the locale information found in the NLS files. If set, then any change to the CMS language after the first initial load of the site will not adjust the locale. This config entry can be used when the nls information in cmsms's config entries is incorrect or inaccurate, but may cause problems if different locales are required for different pages of the website.

    2. 'default_encoding' (deprecated):

      The $config['default_encoding'] entry in the config.php can be used to override the encoding that is used when generating the html pages but may cause problems when different encodings are required for different pages (though this should not happen too often).

    3. 'admin_encoding' (deprecated):

      no longer used.

  2. Language loading
    1. So that as much as possible strings will be displayed in every applicable location, instead of empty values when loading translation files the english translation files are loaded first. Then the individual translations are loaded on top, This means that if a translation is available for a particular string, it will be used. Otherwise the english string will be used. If for given a key, no value has been specified for the english version of that key, an -- Add Me -- string will be displayed.
    2. For optimization purposes, CMSMS will generate an error and not load into memory the language information for the admin interface when handling a frontend request.
  3. Language string overriding

    It is possible to override individual translated strings for a module or for the core in a way that will not be erased on the next module, or CMSMS upgrade. This allows customizing the strings of the module in places where a different word or phrase would be more appropriate in some locations.
    Read more at Customizing language strings »