wiki:Documentation/DevelopingForXinha/Translating

Version 4 (modified by gogo, 5 weeks ago) (diff)

--

Localisation How To

If you need information on how to add Internationalisation to Xinha (how to use the _lc-function) you might look at wiki:Documentation/Internationalisation?.
Xinha supports several languages, see NewbieGuide on how to use them.
This page is on how you can translate Xinha into your own language.

Syntax of Language-Files

There exist one file for the core (source:trunk/lang/de.js) and one file for every plugin (source:trunk/plugins/SuperClean/lang/de.js), where de is the short-form for the language which also must be used for _editor_lang.

The syntax is quite easy:

{
  "english string": "translation",
  "another string": "other translation"
}

(note there is no , after the last translation!)

Charset

All translation-files must be encoded as utf-8, if you don't know how to do that just send them to us and we will convert them.

How To Translate

There exists a script that parses all source-files of xinha and extracts all internationalized strings. This is needed because you won't know what english strings you should write in your file (the existing translations are usually not complete)

  • open contrib/lc_parse_strings.php in an editor
  • remove the die() in line 2 (for security)
  • make sure all lang-folders are writeable for your webserver
  • open the contrib/lc_parse_strings.php in your browser
  • lang/base.js will be written
  • open base.js, translate all strings into your language and save it as yourlangauge.js
  • send the translated file to the xinha-team (best would be to create a new ticket and attach a zip-file with all your langauge-files)

resources (button_*)

It is possible to localize several toolbar-buttons (bold, italic, etc.). To do that you must provide a translation for the button_bold, button_italic, etc. keys in the core-langauge-file.

Possibility 1: one image for every button

  • copy your localized button-images to eg. images/de/bold.gif
  • in the language-file enter: "button_bold": "de/bold.gif"

Possibility 2: using and image-map

  • create a localized image-map (like ed_buttons_main.gif) (only with the localized icons, the others still will be taken from ed_buttons_main.gif!)
  • in the langauge-file enter somthing like: "button_bold": ["de_buttons.gif", 0, 0]