Changes between Version 4 and Version 5 of Documentation/DevelopingForXinha/Translating

03/16/18 07:55:23 (5 weeks ago)



  • Documentation/DevelopingForXinha/Translating

    v4 v5  
    1 = Localisation How To = 
     1= Translating Xinha = 
    3 If you need information on how to add Internationalisation to Xinha (how to use the _lc-function) you might look at wiki:Documentation/Internationalisation. [[BR]] 
    4 Xinha supports several languages, see NewbieGuide on how to use them.[[BR]] 
    5 This page is on how you can translate Xinha into your own language. 
    7 == Syntax of Language-Files == 
    8 There exist one file for the core (source:trunk/lang/de.js) and one file for every 
    9 plugin (source:trunk/plugins/SuperClean/lang/de.js), where de is the short-form for 
    10 the language which also must be used for _editor_lang. 
     5Hello you multi-lingual person you, so you would like to help translate Xinha 
     6or create your own special translation to use? 
    12 The syntax is quite easy: 
    13 {{{ 
    14 { 
    15   "english string": "translation", 
    16   "another string": "other translation" 
    17 } 
    18 }}} 
    19 (note there is no , after the last translation!) 
     8It's really easy! 
    21 == Charset == 
    22 All translation-files must be encoded as utf-8, if you don't know how to do that 
    23 just send them to us and we will convert them. 
     10== First, Download Xinha == 
    25 == How To Translate == 
    26 There exists a script that parses all source-files of xinha and extracts all 
    27 internationalized strings. This is needed because you won't know what english 
    28 strings you should write in your file (the existing translations are usually not 
    29 complete) 
     12In the full Xinha distribution ([wiki:DownloadXinha Download Xinha Here]) you  
     13will find some files under the following directory 
    31  * open contrib/lc_parse_strings.php in an editor 
    32  * remove the die() in line 2 (for security) 
    33  * make sure all lang-folders are writeable for your webserver 
    34  * open the contrib/lc_parse_strings.php in your browser 
    35  * lang/base.js will be written 
    36  * open base.js, translate all strings into your language and save it 
    37    as yourlangauge.js 
    38  * send the translated file to the xinha-team (best would be to create a 
    39    [ new ticket] and attach a zip-file 
    40    with all your langauge-files) 
     15   /lang/merged/*.js 
    42 == resources (button_*) == 
    43 It is possible to localize several toolbar-buttons (bold, italic, etc.). 
    44 To do that you must provide a translation for the button_bold, button_italic, etc. keys in the core-langauge-file. 
     17you can see that there is a file for every currently existing translation there 
     18and also one called "__new__.js".  You will also see there are other lang files  
     19around the place, they are used only when not using a merged file, you don't need 
     20to touch them, just work on /lang/merged/*.js ! 
    46 === Possibility 1: one image for every button === 
     22== Edit or Create the Language File == 
    48  * copy your localized button-images to eg. images/de/bold.gif 
    49  * in the language-file enter: "button_bold": "de/bold.gif" 
     24If your language is there already, simply open that .js file in your favourite 
     25UTF-8 compliant text editor. 
    51 === Possibility 2: using and image-map === 
     27If your language is not there, copy the __new__.js file and create a new one called 
     28[yourlanguagecode].js, for example if you are translating into Klingon, perhaps 
     29"kl.js" and then open it in your favourite UTF-8 compliant text editor. 
    53  * 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!) 
    54  * in the langauge-file enter somthing like: "button_bold": ["de_buttons.gif", 0, 0] 
     31Please note that all translation is in UTF-8 Encoding, do not try to use other  
     32character encodings (character sets), it's not going to end well. 
     34== Test The Language File == 
     36To actually test or use your translation, in your code right before you load  
     37Xinha specify the language and file like this... 
     39    <!-- Set Language To Klingon --> 
     40    <script type="text/javascript> 
     41      _editor_lang              = 'kl'; 
     42      _editor_lang_merged_file  = '/xinha/lang/merged/kl.js'; 
     43    </script> 
     45    <!-- And Load Xinha As Usual --> 
     46    <script type="text/javascript" src="../XinhaCore.js"></script> 
     48that's it, try out Xinha and your language file should provide the translations. 
     50When you have made your translation file and would like to submit it 
     51to Xinha for inclusion in a future distibution of Xinha, please just open a  
     52ticket at and attach your new or improved language file,  
     53be sure to let us know your details to add the the contributors list below! 
     55== Tools == 
     57In the contrib directory there are a few scripts written in PHP to handle the  
     58translation setup tasks. 
     60=== lc_parse_strings.php === 
     62This script goes through all the Xinha files, javascript, php, html, and pulls 
     63out the strings which should get translated.  These are written into lc_base.js 
     64translation files spread through the system, eg /lang/lc_base.js,  
     65/modules/.../lang/lc_base.js, /plugins/.../lang/lc_base.js and so forth. 
     67lc_base.js files do not get committed to the Subversion repository they are  
     68just temporary working files. 
     70=== lc_create_merged_file.php === 
     72This script takes all the lc_base.js files and the existing lang files for a given 
     73language and creates a merged language file, for example 
     75    php contrib/lc_create_merged_file.php fr /tmp/fr.js 
     77creates the French translation merged file /tmp/fr.js 
     79Note that existing merged files are not consulted during this process. 
     81Translators can then work on the merged file to do their translation work. 
     83To make things easy the `lang/merged/` directory contains pre-generated merged  
     84language files of each language of the release, again these are not committed 
     85to the subversion repository. 
     87If you run this script without arguments it will give you some help showing how 
     88you can generate all the merged language files at once, this is done as part of 
     89the release process. 
     91=== lc_split_merged_file.php === 
     93This script takes a merged file and splits it into the constituent lang files 
     94these files are written into a temporary directory structure so that you can  
     95use a diff/merge tool if you wish to compare them rather than actually copying  
     96them into place.  For example, 
     98  php contrib/lc_split_merged_file.php /tmp/fr.js fr 
     100will create a directory structure (it will be printed at completion) in /tmp,  
     102  /tmp/something-unique-here/lang/fr.js 
     103  /tmp/something-unique-here/modules/.../lang/fr.js 
     104  /tmp/something-unique-here/plugins/.../lang/fr.js 
     105  /tmp/something-unique-here/unsupported_plugins/.../lang/fr.js 
     107the directory and some instructions for easily "installing" the generated files 
     108is printed. 
     110== Contributors == 
     112The following people are thanked for providing and updating translations! 
     114ch: Samuel Stone, 
     115cz: Jiri Löw, <> 
     116da: Bjarke M. Lauridsen,, 
     117da: rene, <> 
     118da: Steen Sønderup, <> 
     119de: Broxx, <> 
     120de: Holger Hees, <>, 
     121de: Mihai Bazon, 
     122de: Raimund Meyer 
     123de: sven schomacker,, 
     124de: Udo Schmal (gocher),, 
     125ee: Martin Raie, <> 
     126el: Dimitris Glezos, 
     127es: Derick Leony <> 
     128es: michael Hauptmnn (mhauptma73) ,, 
     129eu: Unkown 
     130fa: Unknown 
     131fi: Unknown 
     132fr: Kevin Huppert - Créabilis,, 
     133he: Liron Newman,, <plastish at ultinet dot org> 
     134he: Mihai Bazon, 
     135hu: Miklós Somogyi, <> 
     136it: Fabio Rotondo <> 
     137it: Mattia Landoni, 
     138it: Udo Schmal (gocher),, 
     139ja: Unknown 
     140lt: Jaroslav Šatkevič, <> 
     141lv: Mihai Bazon, 
     142nb: Kim Steinhaug,,, 
     143nb: Mihai Bazon, <> 
     144nb: Håvard Wigtil <> 
     145nb: ses<> 
     146nl: A.H van den Broek, 
     147nl: Arthur Bogaart 
     148nl: Holger Hees, <> 
     149nl: Maarten Molenschot, 
     150nl: Michel Weegeerink (, 
     151nl: Mihai Bazon, 
     152nl: Raimund Meyer 
     153nl: Udo Schmal (gocher),, 
     154pl: Krzysztof Kotowicz,,,, 
     155pt_br: Cau guanabara (independent developer), 
     156pt_br: Marcio Barbosa, <>, 
     157ro: Mihai Bazon, 
     158ru: Andrei Blagorazumov, 
     159ru: Helen Mitkina (zerok) <e.mitkina at gmail> 
     160ru: Yulya Shtyryakova, <> 
     161sh: Ljuba Ranković, 
     162si: Tomaz Kregar, 
     163sr: Ljuba Ranković, 
     164sv: Erik Dalén, <> 
     165th: Suchin Prasongbundit, <> 
     166tr: Serdar Domurcuk, <>, 
     167vn: Nguyễn Đình Nam, <> 
     168zh_cn: Dave Lo, 
     169b5: Dave Lo,