eZ Publish uses the "eng-GB" locale by default. This behavior is determined by the "Locale" INI setting located in the "[RegionalSettings]" block of the "settings/site.ini" configuration file. If you wish to use another locale for your site then you have to override this setting. Please note that the specified locale will be used as the default value for the "l10n" operator unless you explicitly specify the desired locale when using this operator in your templates. The following examples demonstrate how you can set the site locale.
Let's say that you need to use "nor-NO" as system locale for all your siteaccesses. The following instructions reveal how this can be done.
Add the following lines under the "[RegionalSettings]" block:
Locale=nor-NO
The system will start to use the locale settings specified in the "share/locale/nor-NO.ini" file for all your siteaccesses.
Let's say that you need to use the "nor-NO" locale for one of your siteaccesses. To do this, edit the "site.ini.append.php" file located in the "settings/siteaccess/example/" directory (where "example" is the name of your siteaccess) as described in the previous example and make sure that no locale is specified in the "settings/override/site.ini.append.php" file. After clearing the caches, the "example" siteaccess will start to use the "nor-NO" locale. However, this may not result in the translation of all parts of the interface for this siteaccess (like "Login" and "Sign up" links/buttons etc.) into Norwegian. To do this, you should add the following line under the "[RegionalSettings]" block of the siteaccess "site.ini.append.php" file:
TextTranslation=enabled
This will instruct the system that the strings marked with "i18n" in the templates should be translated according to the current locale. This means that if you set the "nor-NO" locale for your admin siteaccess and enable the "TextTranslation" setting then everything in the administration interface will be translated into Norwegian. (The "TextTranslation" configuration setting is disabled by default.)
You can also specify different locales for the remaining siteaccesses in the same way, otherwise the default "eng-GB" locale will be used for them.
eZ Publish provides many default locale settings where each locale is described in an INI file named by the locale identifier and placed in the "share/locale" directory. "To contribute new locales and/or translations to eZ Publish, visit the Community Translation project page here: http://projects.ez.no/ezpublish_translation, log-in, navigate to the team page ( http://projects.ez.no/ezpublish_translation/team/members ) and request membership. You will be promptly able to contribute new translations and locale to eZ Publish ! ". The following example demonstrates how to add a missing locale.
Let's say that you need to use the "ell-GR" locale on your site. To do this, download Greek translation for eZ Publish from the eZ Publish translation pages http://projects.ez.no/ezpublish_translation (you have to be a member as described in "Adding missing locales above") and unpack it into a temporary location. You should see there a sub-directory called "share" which contains the locale configuration file (share/locale/ell-GR.ini) and the translation file for eZ Publish (share/translations/ell-GR/translation.ts). In addition, the downloaded package may contain a flag icon (share/icons/flags/ell-GR.gif) and/or translation file(s) for some extensions located in the "extension" sub-directory.
Please note that the "translation.ts" file contains eZ Publish specific strings translated into Greek language (the strings that are used in the templates and PHP code). If the "TextTranslation" setting is enabled, the strings from this file will be used for translating different parts of the interface, system messages, warnings etc.
If you copy the "share" sub-directory to the root directory of your eZ Publish installation, set the "ell-GR" locale (as described in the previous two examples) and clear the caches, the system will start to use Greek locale.
In addition to the default locale settings that come with eZ Publish, it is possible to create custom locales. The following examples demonstrate how this can be done.
Let's say that you wish to use Icelandic locale on your site. You can create a custom locale configuration file for this based on the "eng-GB" locale settings. To do this, do the following:
Let's say that you wish to modify the Norwegian locale. The original locale file should not be changed because it will be overwritten next time you upgrade eZ Publish. Instead, you should create a custom locale file based on the original "nor-NO" locale settings. The following text reveals how this can be done.
You must decide the locale code of your language. eZ Publish uses locale codes on the form aaa-AA, where the 3 first lowercase letters describe the language, while the last two uppercase letter describe the country in which the language is spoken. For instance, English as it is spoken in Great Britain would be eng-GB, while US English is eng-US.
Countries are specified by the ISO 3166 Country Code: http://www.iso.ch/iso/en/prods-services/iso3166ma/index.html
Language is specified by the ISO 639-2 Language Code: http://www.loc.gov/standards/iso639-2/php/code_list.php
You can also create a variation of a locale, you will for instance find two variations of nor-NO, nor-NO@intl and nor-NO@spraakraad, that are slight modifications of the original.
This list shows the current ini-files with eZ locales in use in eZ Publish installations:
Locales ini file |
Language (Country) |
cat-ES.ini |
Catalan (Spain) |
chi-CN.ini |
Chinese (China) |
chi-HK.ini |
Chinese (Hong Kong) |
chi-TW.ini |
Chinese (Taiwan) |
cro-HR.ini |
Croatian (Croatia) |
cze-CZ.ini |
Czech (Czech Republic) |
dan-DK.ini |
Danish (Denmark) |
dut-NL.ini |
Dutch (Netherlands) |
ell-GR.ini |
Greek (Greece) |
eng-AU.ini |
English (Australia) |
eng-CA.ini |
English (Canada) |
eng-GB.ini |
English (Great Britain) |
eng-GB@euro.ini |
English (Euro support) |
eng-NZ.ini |
English (New Zealand) |
eng-US.ini |
English (USA) |
esl-ES.ini |
Spanish (Spain) |
esl-MX.ini |
Spanish (Mexico) |
fin-FI.ini |
Finnish (Finland) |
fre-BE.ini |
French (Belgium) |
fre-CA.ini |
French (Canada) |
fre-FR.ini |
French (France) |
ger-DE.ini Germany |
German (Germany) |
ger-DE@euro.ini |
German (Euro support) |
heb-IL.ini |
Hebrew (Israel) |
hin-IN.ini |
Hindi (India) |
hun-HU.ini |
Hungarian (Hungary) |
ind-ID.ini |
Indonesian (Indonesia) |
ita-IT.ini Italy |
Italian (italy) |
jpn-JP.ini |
Japanese (Japan) |
jpn-JP@international.ini |
Japanese (Kanji) |
kor-KR.ini |
Korean (South Korea) |
nno-NO.ini |
Norwegian - Nynorsk (Norway) |
nor-NO.ini |
Norwegian - Bokmål (Norway) |
nor-NO@intl.ini Norway |
Norwegian (intl) |
nor-NO@spraakraad.ini |
Norwegian (Standard set by Språkrådet) |
pol-PL.ini |
Polish (Poland) |
por-BR.ini |
Portugese (Brazil) |
por-MZ.ini |
Portugese (Mozambique) |
por-PT.ini |
Portugese (Portugal) |
por-PT@euro.ini |
Portugese (Euro support) |
rus-RU.ini |
Russian (Russia) |
ser-SR.ini |
Serbian (Srpski) |
slk-SK.ini |
Slovak (Slovakia) |
srp-RS.ini |
Serbian (Српски) |
swe-SE.ini |
Swedish (Sweden) |
tur-TR.ini |
Turkish (Turkey) |
ukr-UA.ini |
Ukrainian (Ukraine) |