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


Ignore:
Timestamp:
03/16/18 07:55:23 (9 months ago)
Author:
gogo
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Documentation/DevelopingForXinha/Translating

    v4 v5  
    1 = Localisation How To = 
     1= Translating Xinha = 
    22 
    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. 
     3[[PageOutline]] 
    64 
    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? 
    117 
    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! 
    209 
    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 == 
    2411 
    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 
    3014 
    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    [http://xinha.python-hosting.com/newticket new ticket] and attach a zip-file 
    40    with all your langauge-files) 
     15   /lang/merged/*.js 
    4116 
    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 ! 
    4521 
    46 === Possibility 1: one image for every button === 
     22== Edit or Create the Language File == 
    4723 
    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. 
    5026 
    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. 
    5230 
    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. 
    5533 
     34== Test The Language File == 
     35 
     36To actually test or use your translation, in your code right before you load  
     37Xinha specify the language and file like this... 
     38 
     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> 
     44     
     45    <!-- And Load Xinha As Usual --> 
     46    <script type="text/javascript" src="../XinhaCore.js"></script> 
     47 
     48that's it, try out Xinha and your language file should provide the translations. 
     49 
     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 http://trac.xinha.org/ and attach your new or improved language file,  
     53be sure to let us know your details to add the the contributors list below! 
     54 
     55== Tools == 
     56 
     57In the contrib directory there are a few scripts written in PHP to handle the  
     58translation setup tasks. 
     59 
     60=== lc_parse_strings.php === 
     61 
     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. 
     66 
     67lc_base.js files do not get committed to the Subversion repository they are  
     68just temporary working files. 
     69 
     70=== lc_create_merged_file.php === 
     71 
     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 
     74 
     75    php contrib/lc_create_merged_file.php fr /tmp/fr.js 
     76 
     77creates the French translation merged file /tmp/fr.js 
     78 
     79Note that existing merged files are not consulted during this process. 
     80 
     81Translators can then work on the merged file to do their translation work. 
     82 
     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. 
     86 
     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. 
     90 
     91=== lc_split_merged_file.php === 
     92 
     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, 
     97 
     98  php contrib/lc_split_merged_file.php /tmp/fr.js fr 
     99 
     100will create a directory structure (it will be printed at completion) in /tmp,  
     101 
     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 
     106 
     107the directory and some instructions for easily "installing" the generated files 
     108is printed. 
     109 
     110== Contributors == 
     111 
     112The following people are thanked for providing and updating translations! 
     113 
     114ch: Samuel Stone, http://stonemicro.com/ 
     115cz: Jiri Löw, <jirilow@jirilow.com> 
     116da: Bjarke M. Lauridsen, http://www.detailx.dk, detailx@gmail.com 
     117da: rene, <rene@laerke.net> 
     118da: Steen Sønderup, <steen@soenderup.com> 
     119de: Broxx, <broxx@broxx.com> 
     120de: Holger Hees, <hhees@systemconcept.de>, http://www.systemconcept.de 
     121de: Mihai Bazon, http://dynarch.com/mishoo 
     122de: Raimund Meyer xinha@ray-of-light.org 
     123de: sven schomacker, http://www.hilope.de, mail@hilope.de 
     124de: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.de 
     125ee: Martin Raie, <albertvill@hot.ee> 
     126el: Dimitris Glezos, dimitris@glezos.com 
     127es: Derick Leony <dleony@gmail.com> 
     128es: michael Hauptmnn (mhauptma73) , http://www.azahost.com/, miguel@azalorea.com 
     129eu: Unkown 
     130fa: Unknown 
     131fi: Unknown 
     132fr: Kevin Huppert - Créabilis, http://www.creabilis.com, kevin.huppert@worldonline.fr 
     133he: Liron Newman, http://www.eesh.net, <plastish at ultinet dot org> 
     134he: Mihai Bazon, http://dynarch.com/mishoo 
     135hu: Miklós Somogyi, <somogyine@vnet.hu> 
     136it: Fabio Rotondo <fabio@rotondo.it> 
     137it: Mattia Landoni, http://www.webpresident.org/ 
     138it: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.de 
     139ja: Unknown 
     140lt: Jaroslav Šatkevič, <jaro@akl.lt> 
     141lv: Mihai Bazon, http://dynarch.com/mishoo 
     142nb: Kim Steinhaug,  http://www.steinhaug.com/, http://www.easycms.no/, kim@easycms.no 
     143nb: Mihai Bazon, <mihai_bazon@yahoo.com> 
     144nb: Håvard Wigtil <havardw@extend.no> 
     145nb: ses<ses@online.no> 
     146nl: A.H van den Broek  http://www.kontaktfm.nl, tonbroek@kontaktfm.nl 
     147nl: Arthur Bogaart a.bogaart@onehippo.org 
     148nl: Holger Hees, <hhees@systemconcept.de> 
     149nl: Maarten Molenschot, maarten@nrgmm.nl 
     150nl: Michel Weegeerink (info@mmc-shop.nl), http://mmc-shop.nl 
     151nl: Mihai Bazon, http://dynarch.com/mishoo 
     152nl: Raimund Meyer xinha@ray-of-light.org 
     153nl: Udo Schmal (gocher), http://www.schaffrath-neuemedien.de/, udo.schmal@t-online.de 
     154pl: Krzysztof Kotowicz, http://www.web.eskot.pl, http://www.eskot.krakow.pl/portfolio/, koto@webworkers.pl, koto1sa@o2.pl 
     155pt_br: Cau guanabara (independent developer), caugb@ibest.com.br 
     156pt_br: Marcio Barbosa, <marcio@mpg.com.br>, http://www.mpg.com.br/ 
     157ro: Mihai Bazon, http://dynarch.com/mishoo 
     158ru: Andrei Blagorazumov, a@fnr.ru 
     159ru: Helen Mitkina (zerok) <e.mitkina at gmail> 
     160ru: Yulya Shtyryakova, <yulya@vdcom.ru> 
     161sh: Ljuba Ranković, http://www.rankovic.net/ljubar 
     162si: Tomaz Kregar, x_tomo_x@email.si 
     163sr: Ljuba Ranković, http://www.rankovic.net/ljubar 
     164sv: Erik Dalén, <dalen@jpl.se> 
     165th: Suchin Prasongbundit, <suchin@joolsoft.com> 
     166tr: Serdar Domurcuk, <serdar.domurcuk@km.co.at>, http://www.km.co.at/ 
     167vn: Nguyễn Đình Nam, <hncryptologist@yahoo.com> 
     168zh_cn: Dave Lo, dlo@interactivetools.com 
     169b5: Dave Lo, dlo@interactivetools.com