fix crash when copy'ing latent plugins
[ardour.git] / TRANSLATORS
1 Ardour User Interface Translation How-To
2
3 Ardour's user interface can be translated into many languages. For this the
4 application uses gettext engine. It works like this: there is a plain text
5 editable PO file for every language that contains a number of sequences like: a
6 line in English, a line in target language and a reference to a line in source
7 code where original text in English comes from. The build system then creates a
8 binary version of each PO file with MO file extension and places it in a system
9 directory where running instance of Ardour will pick and use it.
10
11 Ardour has two main PO files to translate: for user interface and for Ardour's
12 library. Some messages from the library are actually passed to user interface
13 (various warnings, for example), so ideally you have to translate both. For
14 example, Russian translations are located here:
15
16 gtk2_ardour/po/ru.po
17 libs/ardour/po/ru.po
18
19 There are few supplementation translations that can be found here (again,
20 showing the case for Russian):
21
22 libs/gtkmm2ext/po/ru.po
23
24 Every PO file's name is a two-character code, e.g. 'de' for German, 'es' for
25 Spanish, and so on. However it's fairly common to have localizations for local
26 versions of a language, e.g. 'pt_BR' would stand for Brazilian Portuguese, and
27 'es_MX' would stand for Mexican Spanish. Please refer to ISO language code
28 table for details.
29
30 Here is the best workflow for existing translations.
31
32 1. Build Ardour  using './waf' command (this step is actually optional).
33
34 2a. If there is no existing translation for your language, run './waf i18n_pot'
35 which will generate a POT (.pot) file for each of the directories shown
36 above. For each directory you plan to translate, rename the POT file to end in 
37 .po and then continue with step 3.
38
39 2b. If there is an existing translation for your language, run './waf
40 i18n_po' which will bring it up to date (along with all other PO files)
41
42 3. Open the relevant PO file in you PO editor of choice (see below).
43
44 4. Open Ardour, find something untranslated, locate this phrase in PO file, 
45 translate.
46
47 5. Repeat previous step several times, save the PO file.
48
49 6. Run './waf i18n_mo' to regenerate binary MO files and 'sudo ./waf install' 
50 to install them.
51
52 7. Restart Ardour to see what your translation looks like and whether it needs 
53 fixes, e.g. has to be shorter.
54
55 Note that as of Ardour 4 the translations are only installed when you run 
56 './waf i18n' after './waf' and before 'sudo ./waf install'.
57
58 When you are done translating, it's best to get credited for your contribution. 
59 Here is how you can do it:
60
61 1. Run 'git commit -a' (assuming you only modified translation files) and 
62 describe the changes you made. Typically the commit message looks like 
63 'Update German translation'. That should be sufficient.
64
65 2. Run 'git format-patch origin/master' (assuming you worked on a clone of the 
66 master branch. That should generate a file called something like 
67 '0001-Update-German-translation.patch'.
68
69 3. Run 'bzip2 0001-Update-German-translation.patch' to compress the file.
70
71 4. File a new bug report at http://tracker.ardour.org and attach the resulted 
72 compressed file and tell either rgareus (Robin Gareus) or las (Paul Davis) on 
73 the project's IRC channel (#ardour at irc.freenode.net) about your patch.
74
75 There are some more things you need to know.
76
77 1. Where does a phrase come from?
78
79 Often when you go through translation hunting for untranslated messages, you
80 stumble upon things you have no idea where they come from. To assist you there
81 most advanced PO editors have means to tell you which source code file it comes
82 from, or, in some cases, even show the context in source code. Ardour has
83 pretty much meaningful names for source code files, so it should help. If it
84 doesn't, please ask on IRC for help.
85
86 2. Variables
87
88 You will often meet things like "%1" or "%2" in the translation files. This is
89 a variable that should be left intact. Here is an example:
90
91 "Cannot load XML for session from %1"
92
93 When Ardour runs, this "%1" will be substituted with "Ardour" so that the whole
94 phrase will be "Cannot load XML for session from Ardour". If Mixbus (an
95 commercial Ardour's spin-off) runs, this will be "Cannot load XML for session
96 from Mixbus" instead. You get the idea. So just place this variable in your
97 translation in a way that makes the phrase sound natural in your language and
98 make sure you know where the phrase comes from (see above) so that you know how
99 to translate it correctly.
100
101 3. Plural forms
102
103 English has two plural forms, but many other languages have three and even four
104 plural forms. Some parts of Ardour's code respect that, but some not (check for
105 existing bug reports). A PO editor usually simplifies translating every plural
106 form by putting every plural form into a dedicated tab.
107
108 Not every PO editor can calculate the equation for the plural forms in your
109 language, but you can look it up in headers of PO files from some application
110 such a GIMP or Inkscape. Here is an example for Russian:
111
112 http://git.gnome.org/browse/gimp/plain/po/ru.po
113
114 "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n"
115 "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); 10<=4 && (n%100<10 || n"
116 "%100>=20) ? 1 : 2);\n"
117
118 4. PO editors
119
120 It's really up to you which PO editor you choose. These ones are most popular:
121
122 poEdit. It works on Linux, Mac and Windows. The user interface is fairly simple. 
123
124 Lokalize. Part of KDE desktop environment. It's a fairly advanced translation tool.
125
126 GTranslator. Usually considered as GNOME translation tool, but has very few
127 actual GNOME dependencies. Feature-wise it's somewhere between poEdit and
128 Lokalize.