]> git.lyx.org Git - lyx.git/blob - README.localization
Set makeindex as index processor in the docs
[lyx.git] / README.localization
1
2         Localization/Translation FAQ
3                 (2007-2018)
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   https://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 https://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, jEdit etc.). Yet another option is to use a specialized editor for .po
39 files. You can e.g. use the editor "Poedit", Linux users can
40 additionally use e.g. "Lokalize". Using these editors usually makes things easier
41 as they have many tools to assist the translator.
42 If you use Poedit, please uncheck in its settings the option to break lines after
43 80 characters.
44
45
46 3) WHAT DO I NEED TO TRANSLATE?
47
48 If you are using a simple text editor you should translate the strings that
49 appear in the msgid line and write the translation into the msgstr line. Note
50 that a "#, fuzzy" line is just a hint for translation from compiler - in order
51 to get the translation of the current item working you have to delete this
52 line. It is recommended that you take a look at another .po file - that way you
53 can get an idea of what to do. If you are using a specialized po editor
54 then you will see in it the untranslated strings and a place to write your
55 translation for them.
56
57
58 4) WHAT SHOULD I DO WITH THE '&', '|', '$, '%' {} AND [[]] CHARACTERS?
59
60 '&' stands for underlined characters (shortcut) in dialog boxes.
61 '|' stands for underlined characters in menus.
62
63 These chars should be somehow used in your translations, however you'll have to
64 invent your own working shortcuts for dialog and menu entries and resolve
65 possible conflicts of the same shortcut chars in one menu...
66
67 Note also that there are already used global shortcuts (such as p k x c m s a)
68 and you should avoid using these characters for first-level menu shortcuts.
69
70 '$' and '%' are usually used as handlers for formatting or variables to be
71 inserted into the strings. Character sequences like %1$s or %1$d MUST also
72 appear in your translations! Please take them exactly as they are or you may
73 experience crashes when running LyX.
74
75 [[Context]] is used to distinguish otherwise identical strings, which could
76 have different translations depending on the Context. It can also be used to
77 indicate what is substituted for a placeholder. [[Context]] appears only in
78 msgid string and should not be repeated in the translated version.
79
80 {} refer to counters and must not be translated. An example would be:
81 msgid "Algorithm \\arabic{theorem}"
82 msgstr "Algoritmus \\arabic{theorem}"
83
84
85 5) WHAT IS pocheck.pl AND HOW DO I USE IT?
86
87 This is a small script located in the "po" directory of the source that helps
88 you find common errors in your translation. In order to use this script you
89 need the script language Perl installed.
90 Run ./pocheck.pl -h to see all possible switches.
91
92
93 6) HOW CAN I TEST MY TRANSLATION?
94
95 In order to test your translation you need to obtain the LyX sources
96 (from the git repository) and replace the existing .po with yours.
97 Afterwards, you should compile and optionally install LyX (check the
98 INSTALL file for your OS). Note that, as of LyX 2.1, it is not
99 necessary anymore to install anything.
100
101 In order to run LyX with your translation, change the current language
102 in Preferences dialog or use the appropriate LANG variable:
103
104   On Linux: LANG=xx_CC lyx
105   On Windows, you need to change the lyx.bat file and write: set LANG=xx_CC
106
107 xx stands for your language code. CC stands for your country code. So to get,
108 e.g., Czech, the code is "cs_CZ".
109
110 Another possibility is to use the Preferences dialog to set LyX UI to
111 use your language. Note that, as of LyX 2.2, a newly introduced
112 language will not appear in the languages combox unless it corresponds
113 to an entry of the lib/languages file that has a "HasGuiSupport true"
114 property. See this file for more details.
115
116 The most comfortable way to see your updated translation while
117 editing, is running (in linux) "make xx.gmo" in the po directory to
118 compile updated xx.po translation and then run LyX.
119
120 For advanced users - if you want to remerge your files against current source:
121
122 - on Linux: execute the command: make update-po
123 - on Windows: if you compile LyX in install mode, the po files are automatically
124         updated and output to the folder <compilation output folder>\po
125         Another option is to build the target "update-po" in MSVC.
126
127
128 7) HOW TO CONTRIBUTE MY WORK?
129
130 Send your edited xx.po file to po-updates@lyx.org.
131
132 Also you can check https://www.lyx.org/trac/browser/lyxgit/?rev=master to track
133 changes or watch updates.
134
135
136 8) SHALL ALL THE UNUSED STRINGS AT THE BOTTOM OF .PO FILE BE REMOVED,
137    OR SHALL THEY STAY?
138
139 As you wish. They can be reused for generating fuzzy hints when completely
140 new strings appear, no other function.
141
142
143 9) REFERENCES
144
145 For a basic idea of how the translation works, you can look at
146
147   https://en.wikipedia.org/wiki/Gettext
148
149 For detailed reference (including a full list of country and language codes),
150 have a look at
151
152   https://www.gnu.org/software/gettext/manual/gettext.html
153
154
155 Consider subscribing to the documentation list, lyx-docs@lists.lyx.org (rather
156 silent), or the developer's mailing list, lyx-devel@lists.lyx.org (high
157 volume).
158
159
160
161 PART II - Translation of Math environments and Floats in the final output
162 -------------------------------------------------------------------------
163
164 As of 2.0 LyX allows automatic translation in tex/dvi/ps/pdf output for math
165 environment strings (and some floats) which are not automatically translated via
166 babel package to the localized form.  For example the environment "Exercise"
167 becomes "Aufgabe" in the output of the documents with language set to German.
168
169 These translations are taken from the previously translated .po file before the
170 final major LyX release (e.g. 2.0.0) and are fixed for all next minor releases
171 (e.g. 2.0.x) in order to have fixed output of LyX documents.
172
173 The current translation for your language can be found in the file
174 lib/layouttranslations. An easy way to check many of the translations is to
175 simply load lib/examples/localization_test.lyx in LyX and read its
176 instructions.
177
178 The problematic strings can be then fixed in the .po file. For inspiration the
179 typical places in .po files, where to fix the translation, can be seen on the
180 following commit: https://www.lyx.org/trac/changeset/38169.
181
182 If you need to manually regenerate the layouttranslations file from .po files
183 - Under Linux: If using autotools, execute the command
184  `make ../lib/layouttranslations'
185  in the po directory. If using CMake, execute the command
186  `make layouttranslations1'
187  in the build directory.
188  The Python polib library is needed for building the output file.
189 - Under Windows:
190  1. install the Python extensions "polib". To do this,
191  1.1 open a commen line prompt in the folder where you find the file "pip.exe"
192      withing the python installation folder.
193  1.2 execute the command
194      pip install polib
195  2. close the command prompt and open the file "lyx.sln" with MSVC. You find
196     file in the compilation result folder you set for LyX
197  3. right click in MSVC on the target "layouttranslations1" and choose "Rebuild"
198
199 Optionally - to quickly check whether some new translatable strings appeared
200 for your language you can always check ../lib/layouttranslations.review.
201
202 Q: Running make ../lib/layouttranslations returns with just saying
203    ../lib/layouttranslations is up to date.
204 A: To force regerenation, use something like (XX is your language)
205    make -W XX.po ../lib/layouttranslations