]> git.lyx.org Git - lyx.git/blob - README.localization
doc - last updates are from 2015.
[lyx.git] / README.localization
1
2         Localization/Translation FAQ
3                 (2007-2015)
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.
98
99 In order to run LyX with your translation, change the current language
100 in Preferences dialog or use the appropriate LANG variable:
101
102   On Linux: LANG=xx_CC lyx
103   On Windows, you need to change the lyx.bat file and write: set LANG=xx_CC
104
105 xx stands for your language code. CC stands for your country code. So to get,
106 e.g., Czech, the code is "cs_CZ".
107
108 Another possibility is to use the Preferences dialog to set LyX UI to
109 use your language. Note that, as of LyX 2.2, a newly introduced
110 language will not appear in the languages combox unless it corresponds
111 to an entry of the lib/languages file that has a "HasGuiSupport true"
112 property. See this file for more details.
113
114 The most comfortable way to see your updated translation while
115 editing, is running (in linux) "make xx.gmo" in the po directory to
116 compile updated xx.po translation and then run LyX.
117
118 For advanced users - if you want to remerge your files against current source:
119
120 - on Linux: execute the command: make update-po
121 - on Windows: either build the update-po target in MSVC
122               or run the command: msbuild po\update-po.vcxproj
123               (depending on the directory you are in)
124
125
126 7) HOW TO CONTRIBUTE MY WORK?
127
128 Send your edited xx.po file to po-updates@lyx.org.
129
130 Also you can check http://www.lyx.org/trac/browser/lyxgit/?rev=master to track
131 changes or watch updates.
132
133
134 8) SHALL ALL THE UNUSED STRINGS AT THE BOTTOM OF .PO FILE BE REMOVED,
135    OR SHALL THEY STAY?
136
137 As you wish. They can be reused for generating fuzzy hints when completely
138 new strings appear, no other function.
139
140
141 9) REFERENCES
142
143 For a basic idea of how the translation works, you can look at
144
145   http://en.wikipedia.org/wiki/Gettext
146
147 For detailed reference (including a full list of country and language codes),
148 have a look at
149
150   http://www.gnu.org/software/gettext/manual/gettext.html
151
152
153 Consider subscribing to the documentation list, lyx-docs@lists.lyx.org (rather
154 silent), or the developer's mailing list, lyx-devel@lists.lyx.org (high
155 volume).
156
157
158
159 PART II - Translation of Math environments and Floats in the final output
160 -------------------------------------------------------------------------
161
162 As of 2.0 LyX allows automatic translation in tex/dvi/ps/pdf output for math
163 environment strings (and some floats) which are not automatically translated via
164 babel package to the localized form.  For example the environment "Exercise"
165 becomes "Aufgabe" in the output of the documents with language set to German.
166
167 These translations are taken from the previously translated .po file before the
168 final major LyX release (e.g. 2.0.0) and are fixed for all next minor releases
169 (e.g. 2.0.x) in order to have fixed output of LyX documents.
170
171 The current translation for your language can be found in the file
172 lib/layouttranslations. An easy way to check many of the translations is to
173 simply load lib/examples/localization_test.lyx in LyX and read its
174 instructions.
175
176 The problematic strings can be then fixed in the .po file. For inspiration the
177 typical places in .po files, where to fix the translation, can be seen on the
178 following commit: http://www.lyx.org/trac/changeset/38169.
179
180 If you need to manually regenerate the layouttranslations file from .po files
181 run `make ../lib/layouttranslations' in the po directory. The Python polib
182 library is needed for building the output file.
183
184 Q: Running make ../lib/layouttranslations returns with just saying
185    ../lib/layouttranslations is up to date.
186 A: To force regerenation, use something like (XX is your language)
187    make -W XX.po ../lib/layouttranslations