]> git.lyx.org Git - lyx.git/blob - README.localization
README.localization: typos and grammar
[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. [[Context]] appears only
75 in msgid string and should not be repeated in the translated version.
76
77 {} refer to counters and must not be translated. An example would be:
78 msgid "Algorithm \\arabic{theorem}"
79 msgstr "Algoritmus \\arabic{theorem}"
80
81
82 5) WHAT IS pocheck.pl AND HOW DO I USE IT?
83
84 This is a small script located in the "po" directory of the source that helps 
85 you find common errors in your translation. In order to use this script you
86 need the script language Perl installed.
87 Run ./pocheck.pl -h to see all possible switches.
88
89
90 6) HOW CAN I TEST MY TRANSLATION?
91
92 In order to test your translation you need to obtain the LyX sources (from the 
93 SVN repository) and replace the existing .po with yours. Afterwards, you should 
94 compile and install LyX (check the INSTALL file for your OS). If you don't 
95 install LyX it won't work. In order to run LyX with your translation, use the 
96 appropriate LANG variable:
97
98   On Linux: LANG=xx_CC lyx
99   On Windows, you need to change the lyx.bat file and write: set LANG=xx_CC
100
101 xx stands for your language code. CC stands for your country code. So to get, 
102 e.g., Czech, the code is "cs_CZ".
103
104 The most comfortable way to see your updated translation while editing, is
105 running (in linux):
106 1. "make xx.gmo" in the po directory to compile updated xx.po translation
107 2. "make install" in root lyx tree to copy xx.gmo to the appropriate location
108    (or do it by hand...)
109
110 For advanced users - if you want to remerge your files against current source
111 files run make update-po. 
112
113
114 7) HOW TO CONTRIBUTE MY WORK?
115
116 Send your edited xx.po file to po-updates@lyx.org.
117
118 Also you can check http://www.lyx.org/trac/browser/lyxgit/?rev=master to track
119 changes or watch updates.
120
121
122 8) SHALL ALL THE UNUSED STRINGS AT THE BOTTOM OF .PO FILE BE REMOVED,
123    OR SHALL THEY STAY?
124
125 As you wish. They can be reused for generating fuzzy hints when completely
126 new strings appear, no other function.
127
128
129 9) REFERENCES
130
131 For a basic idea of how the translation works, you can look at
132
133   http://en.wikipedia.org/wiki/Gettext
134
135 For detailed reference (including a full list of country and language codes),
136 have a look at
137
138   http://www.gnu.org/software/gettext/manual/gettext.html
139
140
141 Consider subscribing to the documentation list, lyx-docs@lists.lyx.org (rather
142 silent), or the developer's mailing list, lyx-devel@lists.lyx.org (high
143 volume).
144
145
146
147 PART II - Translation of Math environments and Floats in the final output
148 -------------------------------------------------------------------------
149
150 As of 2.0 LyX allows automatic translation in tex/dvi/ps/pdf output for math
151 environment strings (and some floats) which are not automatically translated via
152 babel package to the localized form.  For example the environment "Exercise"
153 becomes "Aufgabe" in the output of the documents with language set to German.
154
155 These translations are taken from the previously translated .po file before the
156 final major LyX release (e.g. 2.0.0) and are fixed for all next minor releases
157 (e.g. 2.0.x) in order to have fixed output of LyX documents.
158
159 The current translation for your language can be found in the file
160 lib/layouttranslations. An easy way to check many of the translations is to
161 simply load lib/examples/localization_test.lyx in LyX and read its
162 instructions.
163
164 The problematic strings can be then fixed in the .po file. For inspiration the
165 typical places in .po files, where to fix the translation, can be seen on the
166 following commit: http://www.lyx.org/trac/changeset/38169.
167
168 If you need to manually regenerate the layouttranslations file from .po files
169 run `make ../lib/layouttranslations' in the po directory. The Python polib
170 library is needed for building the output file.
171
172 Q: Running make ../lib/layouttranslations returns with just saying
173    ../lib/layouttranslations is up to date.
174 A: To force regerenation, use something like (XX is your language)
175    make -W XX.po ../lib/layouttranslations