Loading...
 
Skip to main content

History: Interface translation

Source of version: 77 (current)

Copy to clipboard
            {REMARKSBOX(type="warning" title="Needs an update")}
* get_string.php is now at php console.php translation:getstrings
* See ((tw:i18n.tiki.org)) for an update on that site
* The Tiki community has moved from SVN to Git
{REMARKSBOX}

^ This is not documentation about __using__ Tiki but documentation for tiki site admins about customizing the interface. Perhaps the part about __using custom translations__ should be on doc and the part about __contributing translations__ should be on a i18n workspace on tiki.org. ^


! Translating the Tiki interface
^This page is a kind of ((tutorial)), that needs ((needs review)). Moreover, some more ((screenshot))s would be nice... See related page: ((i18n Admin)).^

''See also * ((Interactive Translation)) of Tiki Interface''

!!# Status of the translations
See: http://i18n.tiki.org/Status

!!# Translate through i18n.tiki.org
One of the easiest ways to contribute to the translations of the Tiki interface is registering at i18n.tiki.org and use the interactive translation feature to get most of the strings available translated into your known languages.

That ususally means commiting changes to the next development version of Tiki (since these changes will be merged into the trunk branch of development).

See: http://i18n.tiki.org

!!# Translate editing the language.* files on disk and use svn

For example, to improve the translation into Catalan, it is necessary to modify the content of the file:

{CODE()}./lang/ca/language.php{CODE}

And since ((tiki6)).1, you can edit the strings at:

{CODE()}./lang/ca/language.js{CODE}

These .php (and .js) file contains a bunch of lines with pieces of sentences or words ("strings of text") like:

{CODE(caption=>Code,wrap=>1)}(...)
"Internationalization" => "Internacionalització (I18n)",
"I18n setup" => "Configuració de I18n ",
"Best Language" => "Millor idioma",
"Restrict available languages" => "Restringeix idiomes disponibles",
"Available languages:" => "Idiomes disponibles:",
// "Intertiki exchange feature" => "Intertiki exchange feature",
// "Intertiki client" => "Intertiki client",
(...)
{CODE}

Comments start with "__// __", but some lines that have not been translated yet also starts with those characters:

{CODE(caption=>Code,wrap=>1)}// "Intertiki exchange feature" => "Intertiki exchange feature",{CODE}

When a line have been correctly translated, you can delete the two initial slashes and the blank which follows to let Tiki use the translation:

{CODE(caption=>Code,wrap=>1)}"Intertiki exchange feature" => "Funcionalitat d'intercanvi Intertiki",{CODE}

Once you have improved or fixed the translations in the __language.php__ file, you can overwrite the original file on the server (/lang/ca/language.php). It is highly recommended to make a backup copy of the original file; you can rename it to language.php.old. Done the above, to load the translations to the server, login as administrator and then execute the following request on the browser's address bar:

{CODE(caption=>Code,wrap=>1)}http://yourdomain/get_strings.php?lang=ca
{CODE}

Finally, to apply the new translation in the current instance of Tiki, you must clear the system cache.You can then continue translating and improving translations by repeating the process as frequently as desired. 

If you want to share the translation improvements for a language, you can share the language.php file in the Tiki Git repository (the central repository of code; ''keep reading, further down ''). 

This general process has some variants, depending on how to edit the file that contains the text strings. Shortly, you can modify: 
# Each time directly against the central repository svn. ((dev:SVNTips|How to commit))
# Previously through Wiki pages 
# Previously through Tiki itself (database) 

Be careful that the language.php is a php parseable file. So you must not change some lines at the top
{CODE(caption=>Code,wrap=>1)}
<?php // -*- coding:utf-8 -*-
$lang=Array(
{CODE}
And some lines at the bottom
{CODE(caption=>Code,wrap=>1)}
"###end###"=>"###end###");
?>
{CODE}
Be also careful to respect the syntax on each line
{CODE(caption=>Code,wrap=>1)}
"..." => "...",
{CODE}
Each string is surrounded with double quotes ". If you need to add a double quote in your string, precede it with a \ like this : \". Do not forget the comma at the end of each line. Separate the 2 strings by =>.

!!!# Character sets
The file must be saved in utf8 encoding.
If you're using Emacs (external link) then it's easy to change the encoding of a file. Simply open the file, and then type '-+C-x RET f+-' which runs the commandset-buffer-file-coding-system. Now choose utf-8 from the list.

!!!# How to contribute your translation improvements to Tiki
In order to have your translation improvements contributed to Tiki code (so that they are included in new releases, etc), you have to commit then to the branch equivalent to your tiki installation. Or to trunk branch.

For more information about branches and how to commit, check:
http://dev.tiki.org/Commit 

For more information on how to merge strings translated from trunk into previous branches, see:
http://dev.tiki.org/Merge+language+improvements

!!!# Reference sites
* OpenTrad Apertium: On-line free software translator, including Catalan-French, French-Catalan, Catalan-English, English-Catalan, among others.
+ [http://xixona.dlsi.ua.es/prototype/]
+ [http://www.opentrad.org]

* Dictionary English-Catalan (open source code):
+ [http://www.ibiblio.org/dacco/cat/]

!!!# PHP/Smarty translations 
!!!!# Others: Convert to .PO file 
Also there is the option to convert the language.php to a __.po__ file, in order to take advantage of other tools which support the translation of __PO__ files using the GNU ''Gettext''. 

This system is not explained here. You can find more information at:
* [http://tiki.org/PO+Convertor+for+TikiWiki]


!!!!# Translation through Tiki interface (database) 
You need to enable the option: "Admin > ((i18n)) (Internationalization) > __Use database for translation__", and afterwards, clean caches ("Admin > System Administration" > ./templates_c/ __Empty__). 

Then, the link is enabled in the main application menu: ''Admin > __Edit languages__'', that will bring to an url like:

{CODE()}http://yourdomain/tiki-edit_languages.php{CODE}

Then it is necessary to create the translation into the database, for the Catalan language in this example, and tell Tiki to import the text strings already translated at the file __language.php__. This is performed in some short steps: 
# Tell Tiki to create a record for the new language (Catalan) into the database 
## Create Language 
++ Shortname: __ca__ (like en) 
++ Longname: __Catalan__ (like English) 
## Click in the ''Create'' button
# Select the language you want to edit (Catalan) in the drop down menu. 
## Select the language to edit: __ca__ 
## Click on the button ''Set'' 
# Then go to the link above called: ''Im- Export Languages'', 
+ that will lead you to to an url like: 
** {CODE()}http://yourdomain/tiki-imexport_languages.php?{CODE} 
# Import the text strings of the language.php in Catalan 
## Go to "__Import > Select the language to__", and choose __Catalan (Catalan,ca)__ in the drop down menu. ## Click on the button ''Import''. 
# Clean cache ("Admin > System Admin" > empty the three sections). 
+ You will see already the interface in your new language (Catalan, in this example).

To edit the text strings, then you need to:
Go to "Admin > Edit languages". In "Edit or export/import Languages", select the language you want to edit (do as explained above), and afterwards go to "__edit Translations__". 
Then you will be able to edit the text strings you want, search any of them, etc. The process is quite intuitive.

{CENTER()}||::{img src="img/wiki_up/editar_traduccio_bd_catala.png" }::||{CENTER}

Once finished, export the translation to the file language.php (through the link "__Import/Export Languages__"), and select the language you want to export. It Is necessary that the file and unix folder are writable for the apache user, if in a GNU/Linux or similar environment. 

At the end, it is necessary to take this generated file language.php (in __./lang/ca/language.php__) and upload it (commit changes) the central repository of code of Tiki at sourceforge.net, through SVN, in case you want that other people can benefit from your improvements (desirable! (:wink:)).

[http://tikiwiki.svn.sourceforge.net/viewvc/tikiwiki?view=revision&revision=28041|An example of adding a language]

{ANAME()}customize{ANAME}
!!!# Custom translations
It is possible to customize your strings translation without changing the lang/your_language/language.php file. It is very convenient when you upgrade or sync with the latest. You can keep your translations.
Your strings must be put in a file lang/your_language/custom.php. This file must be readable by the server. The file must have UTF-8 encoding. The format is very close to the format of language.php
{CODE()}
<?php
$lang_custom = array(
"Hello"=>"My Hello",
"This is the place to customize your translation"=>":-)",
);
$lang = array_merge($lang, $lang_custom); //###trebly: this changed will not be probably necessary for 7.x after 01/18/2011
{CODE}

In Tiki 9.x there is this on the last line:
{CODE()}$lang = $lang_custom + $lang;{CODE}

A file example is located at -+lang/fr/custom.php_example+-.
You can customize any translation with this file by putting exactly the same string on the left as in -+language.php+-. The strings that are not in -+custom.php+- are still translated as specified in -+language.php+-.
You can even change the English strings by using this file. For instance, if you do not like 'Contact Us' but prefer 'Contact Form' you can have a -+lang/en/custom.php+- like this
{CODE()}
<?php
$lang_custom = array(
"Contact Us'=>'Contact Form'",
);
$lang = $lang_custom + $lang;
{CODE}
Note : Be aware that any file like "language_*.php" will be also included in the translation.

When you are on a ((MultiTiki|multitiki)), you can have a -+lang/your_language/custom.php+- and a -+lang/your_language/your_tikidomain/custom.php+-

!!!!# Custom JavaScript Translations
Some text can only be translated with JavaScript in the client browser. To do this add a file -+lang/your_language/custom.js+- using code in this format (as found in -+lang/fr/custom.js_example+-)
{CODE(colors="javascript")}
lang = $.extend(lang, {
	"Favorite" : "My favourite!",
	"Example in English" : "Translated text here"
	// remember IE does not support ending comma on last item
});
{CODE}

(:arrow:) Be sure the file is saved with UTF-8 encoding. If the file is not saved with UTF-8 encoding, a fatal error may result and no Tiki pages will display. Terms/phrases in the custom file will be used in place of the same terms/phrases in the regular language file. (Not just anything can be added to these files, of course. They must be strings specified for translation in the templates, etc.)

!!!!# Custom JavaScript Translations Without a File
If you cannot access the file system you can add similar code into the ''Custom JavaScript'' preference on the Look & Feel control panel.

{CODE(colors="javascript")}if (jqueryTiki.language === "fr") {
  lang = $.extend(lang, {
    "Are you sure you want to unassign this module?" : "This is a good test js string to try!",
    "Example in English" : "Translated text here"
    // remember IE does not support ending comma on last item
  });
}
{CODE}
!!# More Information
* ((i18n|Internationalization))
* ((i18n Admin|Internationalization Admin))
* ((Interactive Translation)) of Tiki Interface
* ((Multilingual Wiki))
* [http://tiki.org/i18n]

-=Alias names for this page=-
(alias(Translating Tiki interface)) | (alias(Translating interface)) | (alias(Interface Translations))


        

History

Advanced
Information Version
Marc Laporte 77
Marc Laporte 76
luciash d' being 🧙 75
Dustin Ghia Improvement in the instructions to load a language.php file and make your changes effective. 74
Bernard Sfez / Tiki Specialist Adding an outdated remarksbox 73
Jonny Bradley safer 72
Jonny Bradley 71
Jonny Bradley add better notes about custom.js 70
Yves Kipondo 69
Xavier de Pedro 68
Xavier de Pedro 67
Xavier de Pedro update with current approaches (includes i18n.t.o) 66
Marc Laporte Remove comments because folks will use this directly 65
Marc Laporte 64
luciash d' being 🧙 63
Marc Laporte 62
Bernard Sfez 61
Marc Laporte 60
Xavier de Pedro 59
Xavier de Pedro 58
Xavier de Pedro imho, as tiki admin, I wanted to know how to do this (even if I didn't know how to edit php files). So this deserves staying in doc.t.o. 57
Olaf-Michael Stefanov 56
Olaf-Michael Stefanov 55
Bernard TREMBLAY Remark on custom language : change : the merge intragrated into tra 54
Philippe Cloutier 53
Philippe Cloutier 52
Philippe Cloutier 51
Philippe Cloutier 50
Philippe Cloutier UTF-8 support is now ubiquitous 49
Philippe Cloutier 48
Philippe Cloutier transfert warning from Interface translation 2 47
Philippe Cloutier 46
Philippe Cloutier 45
Marc Laporte 44
Daniel Gauthier Pretty sure there should be a closing hiphen. 43
Daniel Gauthier typo 42
Xavier de Pedro 41
Marc Laporte 40
Marc Laporte 39
Marc Laporte 38
Marc Laporte 37
Marc Laporte 36
Marc Laporte 35
Dominic minor changes to Ebglish grammer & vocabulary 34
Marc Laporte 33
Kissaki 32
Kissaki 31
Kissaki 30
Kissaki this only makes it more complicated. If someone uses it that way, he'll do… 29
Kissaki typo 28
  • «
  • 1 (current)
  • 2