Multiple languages
One Exponential installation can hold its content in many languages. Each content object can have a translation in every language of the installation, and each siteaccess decides which languages it shows and in which order. Interface texts (buttons, labels) are translated separately, through the translation files of the locale.
Content languages
The languages content can be written in are added under Setup > Languages. Each is identified by a locale code such as eng-US or ger-DE, whose file in share/locale/ gives its name, date and number formats and writing direction.
Internally each language has an ID that is a single bit: 2, 4, 8, 16 and so on (1 is reserved). An object records its languages as the sum of their IDs, its language mask. That is why "every object in German" is one quick bit test on every database, and why an installation can have at most 62 content languages on 64-bit PHP.
Translations of an object
- Main language. Every object has one: the language it was created in, unless an editor chose another. It cannot be removed while it is the main one.
- Translating creates a new version that adds or changes the content of one language; the other languages are copied as they were. Attributes marked "Disable translation" in the class have one value for all languages.
- Always available. An object with this flag is shown in its main language on a siteaccess that lists none of its languages. Folders, users, user groups and media are usually always available, so a German site still finds the folder of an English article or the user who wrote it. The class gives the default for new objects.
- Names and addresses exist per language: a translated article has a German name and a German URL alias.
Which language a siteaccess shows
Each siteaccess sets its languages in site.ini [RegionalSettings]:
<?php /* #?ini charset="utf-8"? # settings/siteaccess/site_ger/site.ini.append.php: a German site that falls back to English [RegionalSettings] Locale=ger-DE ContentObjectLocale=ger-DE SiteLanguageList[] SiteLanguageList[]=ger-DE SiteLanguageList[]=eng-US ShowUntranslatedObjects=disabled TranslationSA[] TranslationSA[site_ger]=Deutsch TranslationSA[site]=English */ ?>
| Setting | Meaning |
|---|---|
| Locale | The interface language and the formats of dates and numbers. |
| ContentObjectLocale | The language new content is created in. |
| SiteLanguageList[] | The languages content is shown in, by preference: the first one an object has is used. An object in none of them is left out, unless it is always available. |
| ShowUntranslatedObjects | enabled shows objects in none of these languages too, in their main language (the administration uses this). |
| TranslationSA[] | The siteaccess of each language, for a language switcher. |
A common setup is one siteaccess per language, each with its own SiteLanguageList[], addressed by path (/eng, /ger) or by host. Adding, translating, moving and removing languages safely is described in the Content languages guide.
Contributors
- Balazs Halasy
- Andrea Melo Maintainer
- Geir Arne Waaler Maintainer
- Graham Brookins Updated Maintainer
Comments
Add a comment