Procházet zdrojové kódy

Adds documentation for the translation.

master
hristoterezov před 10 roky
rodič
revize
f902b99287
1 změnil soubory, kde provedl 57 přidání a 0 odebrání
  1. 57
    0
      lang/Translation.md

+ 57
- 0
lang/Translation.md Zobrazit soubor

@@ -0,0 +1,57 @@
1
+Jitsi Meet Translation
2
+==========================
3
+Jitsi Meet uses [i18next](http://i18next.com) library for translation. 
4
+i18next uses separate json files for each language. 
5
+
6
+
7
+Translating Jitsi Meet
8
+======================
9
+The translation of Jitsi Meet is integrated with Pootle. You can translate Jitsi Meet via our Pootle user interface on 
10
+[http://translate.jitsi.org](http://translate.jitsi.org). 
11
+
12
+**WARNING: Please don't create or edit manually the language files! Please use our Pootle user interface!**
13
+
14
+Development
15
+===========
16
+If you want to add new functionality for Jitsi Meet and you have texts that need to be translated please use our translation module.
17
+It is located in modules/translation. You must add key and value in main.json file in English for each translatable text. 
18
+Than you can use the key to get the translated text for the current language.
19
+
20
+**WARNING: Please don't change the other language files except main.json! They must be updated and translated via our Pootle user interface!**
21
+
22
+You can add translatable text in the HTML:
23
+
24
+
25
+* **via attribute on HTML element** - add **data-i18n** attribute with value the key of the translatable text.
26
+
27
+
28
+ ```
29
+ <span data-i18n="dialog.OK">OK</span>
30
+ ```
31
+
32
+
33
+ You can also use APP.translation.generateTranslatonHTML(key, options) to get this HTML code as Javascript string.
34
+
35
+
36
+ ```
37
+ APP.translation.generateTranslatonHTML("dialog.OK") // returns <span data-i18n="dialog.OK">OK</span>
38
+ ```
39
+ 
40
+ The value in the options parameter will be added in data-i18n-options attribute of the element.
41
+ 
42
+ **Note:** If you dynamically add HTML elements don't forget to call APP.translation.translateElement(jquery_selector) to translate the text initially.
43
+
44
+* **via Javascript string** - call APP.translation.translateString(key, options). You can use that method to get the translated string in Javascript and then attach it in the HTML.
45
+ 
46
+ ```
47
+ APP.translation.translateString("dialog.OK") // returns the value for the key of the current language file. "OK" for example. 
48
+ ```
49
+
50
+For the available values of ``options`` parameter for the above methods of translation module see [i18next documentation](http://i18next.com/pages/doc_features).  
51
+
52
+**Note:** It is useful to add attributes in the HTML for persistent HTML elements because when the language is changed the text will be automatically translated.
53
+ Otherwise you should call ``APP.translation.translateString`` and manually change the text every time the language is changed.
54
+
55
+
56
+
57
+

Načítá se…
Zrušit
Uložit