LANGUAGES
Table 6-1 lists the pre-installed language packs for the backoffice user interface.
A difference exists between adding and working with languages for the backoffice user interface and localizing your public website. To support multi-lingual sites, please refer to Chapter 7.
As you can see from Table 6-1, Umbraco offers a lot of flexibility out of the box. A later section covers in detail how to add a language and configure a user for that new language. You can find all the language files in the <install root>/umbraco/config/lang directory.
TABLE 6-1: Pre-Installed Language Packs
Changing the Default Language
Eventually, you may get a client located somewhere in the world where one of the pre-installed languages doesn't do the job. Right now, you can find the languages listed in Table 6-1 as a drop-down form control within the user details form. Figure 6-1 shows the interface. The next section describes in detail how to add another language to this drop-down form control.
In the Web.config file for your Umbraco installation you can change the default backoffice user interface language by setting the alias of the language in the umbracoDefaultUILanguage appSettings key. See Listing 6-1 for an example of changing the default language.
FIGURE 6-1
LISTING 6-1: Web.config (partial)
<appSettings>
…
<add key=“umbracoDisableXsltExtensions” value=“true” />
<add key=“umbracoDefaultUILanguage” value=“fr” />
<add key=“umbracoProfileUrl” value=“profiler” />
…
</appSettings>
Adding and Updating Language Files
Adding a language that is not already pre-installed is a simple task. The bulk of the work is adding all the translations, and not the actual installation of the language pack. The first and foremost requirement is that you need FTP or some other form of remote access to the server where your Umbraco application is hosted. As pointed out earlier, you configure languages using an XML file that contains all the defined and configurable keys that make up the backoffice user interface. Take a look at Listing 6-2 for an extract of the English language file. As you can see, a language file is made up of several different components. Starting at the top, you see:
- <language /> node: This defines the language to which you want this file to apply. For a listing of all the available languages and cultures in .NET, see Table 6-2.
- <creator /> element: You can use this to define who wrote the translation. This element is helpful and necessary if you intend to share your translation with the community by making it available on http://our.umbraco.org/projects.
- <area /> node: This specifies where the individual key is going to be applied. Areas are predefined and cannot be added or changed because they cross-reference with the underlying Umbraco architecture.
- <key /> node: This defines the actual translatable label that is used throughout the Umbraco backoffice.
LISTING 6-2: SampleLanguageFile.xml
<language alias=“en” intName=“English (us)” localName=“English” lcid=“ ”
culture=“en-US”>
<creator>
<name>umbraco</name>
<link>http://umbraco.org</link>
</creator>
<area alias=“main”>
<key alias=“sections”>Sections</key>
…
</area>
<area alias=“defaultdialogs”>
<key alias=“link”>Link</key>
<key alias=“macroDoesNotHaveProperties” version=“4.0”>
<![CDATA[This macro does not contain any properties you can edit]]>
</key>
…
</area>
…
</language>
Notice also that the CDATA section is used in one of the keys in Listing 6-2, which avoids parsing problems if characters such as <, &, or > were used in the description. A CDATA section tells the XML parser to avoid anything within its start and end tags. Table 6-2 provides a list of all the available languages and associated culture codes.
TABLE 6-2: Available Cultures in .NET
CULTURE CODE |
LANGUAGE |
af |
Afrikaans |
af-ZA |
Afrikaans – South Africa |
sq |
Albanian |
is-IS |
Icelandic – Iceland |
sq-AL |
Albanian – Albania |
ar |
Arabic |
ar-DZ |
Arabic – Algeria |
ar-BH |
Arabic – Bahrain |
ar-EG |
Arabic – Egypt |
ar-IQ |
Arabic – Iraq |
ar-JO |
Arabic – Jordan |
ar-KW |
Arabic – Kuwait |
ar-LB |
Arabic – Lebanon |
ar-LY |
Arabic – Libya |
ar-MA |
Arabic – Morocco |
ar-OM |
Arabic – Oman |
ar-QA |
Arabic – Qatar |
ar-SA |
Arabic – Saudi Arabia |
ar-SY |
Arabic – Syria |
ar-TN |
Arabic – Tunisia |
ar-AE |
Arabic – United Arab Emirates |
ar-YE |
Arabic – Yemen |
hy |
Armenian |
hy-AM |
Armenian – Armenia |
az |
Azeri |
az-AZ-Cyrl |
Azeri (Cyrillic) – Azerbaijan |
az-AZ-Latn |
Azeri (Latin) – Azerbaijan |
eu |
Basque |
eu-ES |
Basque – Basque |
be |
Belarusian |
be-BY |
Belarusian – Belarus |
bg |
Bulgarian |
bg-BG |
Bulgarian – Bulgaria |
ca |
Catalan |
ca-ES |
Catalan – Catalan |
zh-HK |
Chinese – Hong Kong SAR |
zh-MO |
Chinese – Macao SAR |
nn-NO |
Norwegian (Nynorsk)– Norway |
zh-CN |
Chinese – China |
zh-CHS |
Chinese (Simplified) |
zh-SG |
Chinese – Singapore |
zh-TW |
Chinese – Taiwan |
zh-CHT |
Chinese (Traditional) |
hr |
Croatian |
hr-HR |
Croatian – Croatia |
cs |
Czech |
cs-CZ |
Czech – Czech Republic |
da |
Danish |
da-DK |
Danish – Denmark |
div |
Dhivehi |
div-MV |
Dhivehi – Maldives |
nl |
Dutch |
nl-BE |
Dutch – Belgium |
nl-NL |
Dutch – The Netherlands |
en |
English |
en-AU |
English – Australia |
en-BZ |
English – Belize |
en-CA |
English – Canada |
en-CB |
English – Caribbean |
en-IE |
English – Ireland |
es-BO |
Spanish – Bolivia |
en-JM |
English – Jamaica |
en-NZ |
English – New Zealand |
en-PH |
English – Philippines |
en-ZA |
English – South Africa |
en-TT |
English – Trinidad and Tobago |
en-GB |
English – United Kingdom |
en-US |
English – United States |
en-ZW |
English – Zimbabwe |
et |
Estonian |
et-EE |
Estonian – Estonia |
fo |
Faroese |
fo-FO |
Faroese – Faroe Islands |
fa |
Farsi |
fa-IR |
Farsi – Iran |
fi |
Finnish |
fi-FI |
Finnish – Finland |
fr |
French |
fr-BE |
French – Belgium |
fr-CA |
French – Canada |
fr-FR |
French – France |
fr-LU |
French – Luxembourg |
fr-MC |
French – Monaco |
fr-CH |
French – Switzerland |
gl |
Galician |
gl-ES |
Galician – Galician |
ka |
Georgian |
ka-GE |
Georgian – Georgia |
de |
German |
de-AT |
German – Austria |
de-DE |
German – Germany |
de-LI |
German – Liechtenstein |
de-LU |
German – Luxembourg |
de-CH |
German – Switzerland |
el |
Greek |
el-GR |
Greek – Greece |
gu |
Gujarati |
gu-IN |
Gujarati – India |
he |
Hebrew |
he-IL |
Hebrew – Israel |
hi |
Hindi |
hi-IN |
Hindi – India |
hu |
Hungarian |
hu-HU |
Hungarian – Hungary |
is |
Icelandic |
id |
Indonesian |
id-ID |
Indonesian – Indonesia |
it |
Italian |
it-IT |
Italian – Italy |
it-CH |
Italian – Switzerland |
ja |
Japanese |
ja-JP |
Japanese – Japan |
kn |
Kannada |
kn-IN |
Kannada – India |
kk |
Kazakh |
kk-KZ |
Kazakh – Kazakhstan |
kok |
Konkani |
kok-IN |
Konkani – India |
ko |
Korean |
ko-KR |
Korean – Korea |
ky |
Kyrgyz |
ky-KG |
Kyrgyz – Kyrgyzstan |
lv |
Latvian |
lv-LV |
Latvian – Latvia |
lt |
Lithuanian |
lt-LT |
Lithuanian – Lithuania |
mk |
Macedonian |
mk-MK |
Macedonian – Former Yugoslav Republic of Macedonia |
ms |
Malay |
ms-BN |
Malay – Brunei |
ms-MY |
Malay – Malaysia |
mr |
Marathi |
mr-IN |
Marathi – India |
mn |
Mongolian |
mn-MN |
Mongolian – Mongolia |
no |
Norwegian |
nb-NO |
Norwegian (Bokmal) – Norway |
pl |
Polish |
pl-PL |
Polish – Poland |
pt |
Portuguese |
pt-BR |
Portuguese – Brazil |
pt-PT |
Portuguese – Portugal |
pa |
Punjabi |
pa-IN |
Punjabi – India |
ro |
Romanian |
ro-RO |
Romanian – Romania |
ru |
Russian |
ru-RU |
Russian – Russia |
sa |
Sanskrit |
sa-IN |
Sanskrit – India |
sr-SP-Cyrl |
Serbian (Cyrillic) – Serbia |
sr-SP-Latn |
Serbian (Latin) – Serbia |
sk |
Slovak |
sk-SK |
Slovak – Slovakia |
sl |
Slovenian |
sl-SI |
Slovenian – Slovenia |
es |
Spanish |
es-AR |
Spanish – Argentina |
es-CL |
Spanish – Chile |
es-CO |
Spanish – Colombia |
es-CR |
Spanish – Costa Rica |
es-DO |
Spanish – Dominican Republic |
es-EC |
Spanish – Ecuador |
es-SV |
Spanish – El Salvador |
es-GT |
Spanish – Guatemala |
es-HN |
Spanish – Honduras |
es-MX |
Spanish – Mexico |
es-NI |
Spanish – Nicaragua |
es-PA |
Spanish – Panama |
es-PY |
Spanish – Paraguay |
es-PE |
Spanish – Peru |
es-PR |
Spanish – Puerto Rico |
es-ES |
Spanish – Spain |
es-UY |
Spanish – Uruguay |
es-VE |
Spanish – Venezuela |
sw |
Swahili |
sw-KE |
Swahili – Kenya |
sv |
Swedish |
sv-FI |
Swedish – Finland |
sv-SE |
Swedish – Sweden |
syr |
Syriac |
syr-SY |
Syriac – Syria |
ta |
Tamil |
ta-IN |
Tamil – India |
tt |
Tatar |
tt-RU |
Tatar – Russia |
te |
Telugu |
te-IN |
Telugu – India |
th |
Thai |
th-TH |
Thai – Thailand |
tr |
Turkish |
tr-TR |
Turkish – Turkey |
uk |
Ukrainian |
uk-UA |
Ukrainian – Ukraine |
ur |
Urdu |
ur-PK |
Urdu – Pakistan |
uz |
Uzbek |
uz-UZ-Cyrl |
Uzbek (Cyrillic) – Uzbekistan |
uz-UZ-Latn |
Uzbek (Latin) – Uzbekistan |
vi |
Vietnamese |
Changing the Backoffice UI Language
Not all your administrators or editors will be comfortable working with the default English language that is set in the Umbraco backoffice. In order to support languages that are not shipped with Umbraco, you must add the language file and name it according to the associated culture code, as listed in Table 6-2. The instructions that follow detail how to do this.
- Copy an existing language file in the <install root>/umbraco/config/lang folder by right-clicking the file (for example en.xml) and selecting the Copy menu item. Paste the copied file by right-clicking in the same folder pane and selecting Copy menu item.
- Rename the copied file using the culture code associated with your selected language.
- Open the file and set the appropriate language and culture using the values shown in Table 6-2.
- Translate all the <key …/> elements as needed for the new language.
- Save the new language file.
- Navigate to the Users section in the Umbraco backoffice.
- Select the user that requires the new language by clicking the user node and changing the language designation, as shown in Figure 6-1.
If the user whom you are updating to use the new language is logged in while you make the change, he or she must log out and log in to the backoffice again for the language to update.