Internationalization

From MODx Wiki

Jump to: navigation, search

Contents

How to use MODx in other languages

Here is a list of trick for better internalionalisation (i18n) of MODx. This was write for the 0.9.5 version of MODx and is subject to changes. Note : Most of this assume than MODx is translated in your language.

Back-end settings

How-to set the manager in my language ?

In the Manager go to Tools > Configuration > Site and change the default language. You even sometime have the choice between UTF-8 and a default encoding.

How-to change the Front-end editor language ?

In the Manager go to Tools > Configuration > Interface & Features. Change the language under your default front-end editor name (generally TinyMCE).

Front-end settings

How to have the dates displayed in my language ?

You have to add/change this PHP setting into the used snippets.

setlocale(LC_ALL, 'en_EN');

Replace 'en_EN' by your language. For example 'fr_FR' ('fr_FR.UTF-8' for FreeBSD) or 'de_DE'. This will work only if the snippet uses the strftime() function to format dates but not for date() function.

Instead of modifying all the snippets can change add a special Template variable for this :

  • Create a template variable called 'setdatelocale' for example
  • Use the @eval binding like this in the default value :
@EVAL setlocale(LC_ALL, 'en_EN');

(change according to your language).

  • Call the template variable in the beginning of your default template :
[*setdatelocale*]

You can even create more than one TV (setdatelocalefr ; setdatelocaleen ; setdatelocalede) for multilingual templates.

How to have Ditto to display messages in my language ?

In your Ditto call add the &language variable. For example :

[!Ditto? &startID=`2` &total=`1` &sortBy=`pub_date` &displayArchive=`0` &language=`francais-utf8` &mode=`production` &tpl=`tpl'!]

See the list of available languages for Ditto in assets/snippets/ditto/lang

Personal tools