]> git.lyx.org Git - lyx.git/blob - README.localization
README.localization: a precision
[lyx.git] / README.localization
1
2         Localization/Translation FAQ
3                 (2007-2011)
4               
5     by Ran Rutenberg, Pavel Sanda, Michael Gerz
6
7
8 PART I - Interface translation
9 ------------------------------
10
11 This file is mainly intended for those who have no or little experience using 
12 .po files, but want to contribute by translating the LyX interface (i.e. menu
13 and dialog items, console messages) into their native language.
14
15
16 1) WHERE DO I START?
17
18 The file you need to edit is an xx.po file where xx stands for your language's
19 two letter code. For a list of language codes look at:
20
21   http://www.gnu.org/software/gettext/manual/html_mono/gettext.html#Language-Codes
22
23 If you want to start from scratch then you should obtain a copy of the lyx.pot
24 and name it after your language. German would be for example de.po and Polish
25 pl.po. This file is generated in the "po" directory of the source tree during
26 the compilation.
27
28 There are basically two source trees you can start to work with - trunk
29 (development version) and branch (stable version). Unless the development
30 version is shortly before release it is better to start your translating
31 work on the stable version. If you have no idea how to get those trees you
32 can follow http://www.lyx.org/HowToUseGIT page.
33
34
35 2) HOW DO I EDIT PO FILES?
36
37 PO files can be edited with any text editor available for your system (e.g. 
38 Vim, NotePad etc.). Yet another option is to use a specialized editor for .po 
39 files. You can e.g. use the editors "poEdit" or "jEdit", Linux users can 
40 additionally use e.g. "kbabel". Using these editors usually makes things easier 
41 as they have many tools to assist the translator.
42
43
44 3) WHAT DO I NEED TO TRANSLATE?
45
46 If you are using a simple text editor you should translate the strings that
47 appear in the msgid line and write the translation into the msgstr line. Note
48 that a "#, fuzzy" line is just a hint for translation from compiler - in order
49 to get the translation of the current item working you have to delete this
50 line. It is recommended that you take a look at another .po file - that way you
51 can get an idea of what to do. If you are using a specialized po editor
52 then you will see in it the untranslated strings and a place to write your
53 translation for them.
54
55
56 4) WHAT SHOULD I DO WITH THE '&', '|', '$, '%' {} AND [[]] CHARACTERS?
57
58 '&' stands for underlined characters (shortcut) in dialog boxes.
59 '|' stands for underlined characters in menus.
60
61 These chars should be somehow used in your translations, however you'll have to 
62 invent your own working shortcuts for dialog and menu entries and resolve 
63 possible conflicts of the same shortcut chars in one menu... 
64
65 Note also that there are already used global shortcuts (such as p k x c m s a)
66 and you should avoid using these characters for first-level menu shortcuts.
67
68 '$' and '%' are usually used as handlers for formatting or variables to be 
69 inserted into the strings. Character sequences like %1$s or %1$d MUST also 
70 appear in your translations! Please take them exactly as they are or you may 
71 experience crashes when running LyX.
72
73 [[Context]] is used to distinguish otherwise identical strings, which could
74 have different translations depending on the Context. It can also be used to
75 indicate what is substituted for a placeholder. [[Context]] appears only in
76 msgid string and should not be repeated in the translated version.
77
78 {} refer to counters and must not be translated. An example would be:
79 msgid "Algorithm \\arabic{theorem}"
80 msgstr "Algoritmus \\arabic{theorem}"
81
82
83 5) WHAT IS pocheck.pl AND HOW DO I USE IT?
84
85 This is a small script located in the "po" directory of the source that helps 
86 you find common errors in your translation. In order to use this script you
87 need the script language Perl installed.
88 Run ./pocheck.pl -h to see all possible switches.
89
90
91 6) HOW CAN I TEST MY TRANSLATION?
92
93 In order to test your translation you need to obtain the LyX sources
94 (from the git repository) and replace the existing .po with yours.
95 Afterwards, you should compile and optionally install LyX (check the
96 INSTALL file for your OS). Note that, as of LyX 2.1, it is not
97 necessary anymore to install anything. In order to run LyX with your
98 translation, change the current language in Preferences dialog or use
99 the appropriate LANG variable:
100
101   On Linux: LANG=xx_CC lyx
102   On Windows, you need to change the lyx.bat file and write: set LANG=xx_CC
103
104 xx stands for your language code. CC stands for your country code. So to get, 
105 e.g., Czech, the code is "cs_CZ".
106
107 The most comfortable way to see your updated translation while
108 editing, is running (in linux) "make xx.gmo" in the po directory to
109 compile updated xx.po translation and then run LyX.
110
111 For advanced users - if you want to remerge your files against current source:
112
113 - on Linux: execute the command: make update-po
114 - on Windows: either build the update-po target in MSVC
115               or run the command: msbuild po\update-po.vcxproj
116               (depending on the directory you are in) 
117
118
119 7) HOW TO CONTRIBUTE MY WORK?
120
121 Send your edited xx.po file to po-updates@lyx.org.
122
123 Also you can check http://www.lyx.org/trac/browser/lyxgit/?rev=master to track
124 changes or watch updates.
125
126
127 8) SHALL ALL THE UNUSED STRINGS AT THE BOTTOM OF .PO FILE BE REMOVED,
128    OR SHALL THEY STAY?
129
130 As you wish. They can be reused for generating fuzzy hints when completely
131 new strings appear, no other function.
132
133
134 9) REFERENCES
135
136 For a basic idea of how the translation works, you can look at
137
138   http://en.wikipedia.org/wiki/Gettext
139
140 For detailed reference (including a full list of country and language codes),
141 have a look at
142
143   http://www.gnu.org/software/gettext/manual/gettext.html
144
145
146 Consider subscribing to the documentation list, lyx-docs@lists.lyx.org (rather
147 silent), or the developer's mailing list, lyx-devel@lists.lyx.org (high
148 volume).
149
150
151
152 PART II - Translation of Math environments and Floats in the final output
153 -------------------------------------------------------------------------
154
155 As of 2.0 LyX allows automatic translation in tex/dvi/ps/pdf output for math
156 environment strings (and some floats) which are not automatically translated via
157 babel package to the localized form.  For example the environment "Exercise"
158 becomes "Aufgabe" in the output of the documents with language set to German.
159
160 These translations are taken from the previously translated .po file before the
161 final major LyX release (e.g. 2.0.0) and are fixed for all next minor releases
162 (e.g. 2.0.x) in order to have fixed output of LyX documents.
163
164 The current translation for your language can be found in the file
165 lib/layouttranslations. An easy way to check many of the translations is to
166 simply load lib/examples/localization_test.lyx in LyX and read its
167 instructions.
168
169 The problematic strings can be then fixed in the .po file. For inspiration the
170 typical places in .po files, where to fix the translation, can be seen on the
171 following commit: http://www.lyx.org/trac/changeset/38169.
172
173 If you need to manually regenerate the layouttranslations file from .po files
174 run `make ../lib/layouttranslations' in the po directory. The Python polib
175 library is needed for building the output file.
176
177 Q: Running make ../lib/layouttranslations returns with just saying
178    ../lib/layouttranslations is up to date.
179 A: To force regerenation, use something like (XX is your language)
180    make -W XX.po ../lib/layouttranslations