Internationalization Admin
This page explains how to administer a Tiki site with all issues relative to languages Internationalization. To learn how to create a new language, update it, customize the general purpose translation for your specific site, please see: Internationalization User and Interface translation.
How to build a monolingual site?
By default TikiWiki is English/American. But Tiki supports many other languages.
First, you must check if the Tiki strings (the menu texts, messages ...) have been translated in your language for your tiki release. The list and the status of the translations are updated on: http://tikiwiki.org/TikiWikiInternationalizationAndLanguages. You can also see them on you installation by looking in the admin/general panel the list of available language in "Language".
Then, you have to set up some information:
- In the admin/login panel, you have to uncheck "Reg users can change language"
- In the admin/features panel, you have to uncheck "Multilingual" and "Best language"
- In the admin/general panel, you have to set "Language" to your site language
- In the admin/general panel, you have to uncheck "Detect browser language"
- In the admin/general panel, you can set "Default charset for sending mail". Tiki default is UTF-8 but if the default for you language is iso-8859-1 and if you users use mail user agent that are not able to read UTF-8, it is better to set the charset to iso-8858-1. A registered user will always be able to reset this preference.
- In the admin/general panel, you have to set the date formats, if you want the language default, copy/paste from the language.php file.
Some tips:
- Tip: if you want to speed up you site, it is better to "compile" the templates. Go to the panel admin/system admin and click on "compile" of you language.
- Tip: if you want to save some space on disk, you can delete the directories lang/xx where xx is a language you don't use
- Tip: if you want to change some strings, you can edit the file lang/xx/language.php. But be careful, you must follow the syntax and you must use and save the file in UTF-8 encoding. To see your update in action, you must clear the cache tiki build automatically. To do that, go in the panel admin/system admin and click on the "Empty" of templates_c line
It is possible to use the database to store the translated strings instead of the language.php file. See this page for more information
How to build a multilingual site?
Tiki supports multiple languages, it means that the strings and messages can be displayed in a specific language chosen by the user or automatically chosen in function of the browser languages configuration.
The content of some objects (page, article) can also be displayed in the same language than the strings if the translations has been done and established.
To configure a multilingual site
- In the admin/login panel, you have to define the list of languages you want. You have to check "Reg users can change language". You can restrict the available languages by setting "Restrict available languages"
- In the admin/general panel, you have to set the default language for the site, it is the language, the anonymous visitor of your site will see.
- In the admin/general panel, you can check or uncheck "Detect browser language". If it is set, the browser languages will override the site language for an anonymous visitor or for a user who didn't set his user language preference (in the MyTiki/preferences panel)
- In the admin/features panel, you have to check "User Preferences Screen"
To have a multilingual content
- In the admin/features, you have to check "Multilingual". This will give the user the possibility to set the language of a Wiki page or an article and to build a set of translations (he would be able to say that this page/article is the translation of this page/article). Each user who has the right to edit a page/article can set the language and links it to the other translations.
The different languages for a Wiki page or article that has translations are shown in a popup menu, the page/article language first. A user can navigate through the different translations via this menu.
Establishing a set of translations will give Tiki the opportunity to automatically select in some case a Wiki page or an article in the best language for the user.
The best language for a user is the first of the list:
- page language for the articles plugin
- user language (or current language)
- contextual language (for a link in a tiki page it is the page language - not yet implemented)
- browser languages
- site language
For each language with a linguistic variant (ex: en-uk), the root language is added (ex: en) to the list (just after the variant)
Best language
Best language
Force the strings to be in the same language than a page (tw>=3.0)
Use the option Page language forces to display strings in the same language to do that. (Can be backport in tw 2.x: svn revision 14114)
Modules displayed only for some language
Tip
If you want to speed up you site, it is better to "compile" the templates. Go to the panel admin/system admin and click on "compile" of each language.
Goodies
Tiki also has some goodies that can help in a multilingual site:
- Module switch_lang that enables a user or an anonymous to switch language.
- Module switch_lang2 that enables a user or an anonymous to switch language. This module can be easily used to switch from a page in a language to its translation.
- a wiki plugin pluginVersions more generic can be used for language switch
- a wiki plugin pluginLang to display a text only if the language matches
- a wiki plugin pluginTranslated to display a link only if the language matches
- a smarty modifier smartyTranslation to display a text only if the language matches
- In 2.0, you can add an additional parameter to the url switchLang=<langName>, where langName is the 2 language letters code (+ eventually - 2 country letters code). This parameter switches the language (for a logged user, it changes his preference - for an anonymous, it remembers the language in a session variable). Example: tiki-index_raw.php?page=Internationalization&switchLang=fr or tiki-register.php?switchLang=fr
Calendar first day
This can be done on a language basis, you have to edit your lang/your_language/language.php and adapt the translation of the string
First day of week: Sunday (its ID is 0) - translators you need to localize this string!
So for Monday as the first day, translate this string to 1
Add or modify in your language.php file
"First day of week: Sunday (its ID is 0) - translators you need to localize this string!"=>"1",
Where to find a language file
All the language.php files are delivered with Tiki. Just look for the files at: /lang/xx/language.php where xx is a 2-letter or 4-letter language code
FAQ
Character Encoding
Utf8 and php string functions
The strings functions in php are not multibyte safe - and Tiki uses Utf8.
In Tiki1.7, the only way to have the strings working is to use the php multibyte support (http://us3.php.net/manual/en/ref.mbstring.php) and to overload the string functions (http://us2.php.net/mbstring)
In 1.7.2, Tiki supplies a limited mb_substr if this function doesn't exist . Some calls have been changed from substr to mb_substr - no functions are provided for the other string functions.
An interesting article about database in UTF-8 on tikiwiki.org: http://tikiwiki.org/UTF-8
Right to Left Language
- Some wiki markers: {r2l},{l2r}, {rm}, {lm} can be used to change the text direction
- a css BiDi.css has been written for a right to left site.
Developer's documentation (How to enter a string)
Please follow the format convention described in TikiStringsFormatConvention
Some strings seems to be generated on the fly. Please read UnusedWords !
- In Smarty, the strings are between the tags {tr}string{/tr}:
- The string can be on multiline.
- The string can contain Smarty variables. Depending of the language file, the translation can occur before or after the variable substitution . For example :
- {tr}{$value}{/tr}, and value=none or all. The string "{\$value}" will not be found in the language file, but "none"=>"aucun" and "all"=>"tous" will be found.
- {tr}You will send {$nb} emails{/tr}. In the language file, you will find "You will send{\$nb} emails"=>"Vous recevrez {\$nb} emails"
- if you know that a string will be translated later via a variable, please add the comment {*get_strings {tr}string{/tr} *} to have the string added to the language file. (tiki1.9)
- Please enclose your {tr} into double quote to ease the translation with language using simple quote
- In PHP, the strings are the parameter of the function tra
- the string can contain php variable
- The string can be tra("Release %s"). In the language file, you will find "release %s"=>"version %s"
- if you know that a string will be translated later via a variable, please add //get_strings tra("string") to have the string added to the language file.
(tiki1.9)
The translation phase in Smarty occurs at 2 moments
- In a prefilter: it means when the Smarty cache is built. It means that the translation is not done each time you access a template but only once.
- In a plugin : The string with variable or not find by the prefilter function is look again each time the template is accessed.
Linguistic variance
For each language with a variant (ex: en-uk), the root language is added (ex: en) to the list (just after the variant)
Related pages
|