]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - locale/README
Updated my e-mail
[SourceForge/phpwiki.git] / locale / README
1
2 This document describes how to add a new language translation to PhpWiki.
3
4 If you just want to use one of the existing language translations, see
5 part three in 'index.php' to change the default language of your
6 Wiki. Modify the line that sets $LANG to use the two-letter code of
7 one of the supported languages, like this:
8
9     // Select your language/locale - default language "C": English
10     // other languages available: Dutch "nl", Spanish "es", German "de",
11     // Swedish "sv", and Italian, "it".
12     // $LANG="C";
13     $LANG="it";
14
15
16 Phpwiki uses GNU gettext tools to provide and maintain multi-lingual
17 messages for different languages. Even if you are already familiar
18 with xgettext you will want to read this document to be aware of
19 translation issues and tips specific to PhpWiki; perhaps skimming
20 through the Makefile section.
21
22 PhpWiki does not require gettext support to be compiled in to PHP. It
23 automatically provides a pure PHP replacement in case it's not
24 available.
25
26
27 Formalities
28 ===========
29 The modern English language has no clear rules for differentiating
30 between the formal and informal use of the spoken word. This both
31 simplifies and complicates matters for translators, as many languages
32 do still make such a distinction. For the most part, PhpWiki is written
33 using the casual forms of messages and explanatory text--after all the
34 WikiWikiWeb is an open and friendly place. :-)
35
36 However, there is no reason why translations of Wiki commands like
37 "Edit" or "FindPages" should not be written formally. For the sake of
38 recognition or clarity when the word function is the same as another
39 common computer term or menu-item, if you feel it would be more
40 effective to employ a formal variation then please do so. When the
41 formal word is significantly longer than the informal word, make a
42 judgement call or substitute an abbreviation, provided that it will
43 be easily recognised.
44
45 Remember that a good and thorough translation is a subjective and
46 collective process. Once people have had a chance to test-drive your
47 newly-translated PhpWiki there will always be suggestions for
48 reshaping and improving it.
49
50 Diversity and Change are part of WikiEssence. By all means don't
51 belabour the translation process, and have some fun!
52
53
54 General Steps
55 =============
56 The general steps to creating a new language module for PhpWiki:
57
58 1. Copy and rename the master template to create a new file for your
59    language ('phpwiki.pot' => 'xx.po').
60
61 2. Translate all the strings in the new language file ('.po file').
62
63 3. Run 'make' to automatically create or update any additional files
64    ('.po' => '.mo' => 'phpwiki.php' files).
65
66 4. Create translations of the content for the default pages ('pgsrc'
67    files).
68
69
70 Example
71 =======
72 Let's assume for example that you would like to add an Islandic
73 translation to PhpWiki.
74
75
76 Text Strings
77 ------------
78 Duplicate the file phpwiki.pot in the 'locale/po/' folder and name it
79 'is.po' ('is' is the code for Islandic). Next, translate all the
80 strings inside 'is.po' from English to Islandic. Unix Hint: Emacs has
81 a handy "po translation mode" for you. See README.coding in the doc folder.
82
83 Important note about character encoding: 
84   Currently all the language files are saved using the ISO-8859-1
85   character encoding to preserve accented characters. Make sure the text
86   editor you use is capable of performing the appropriate Latin-1
87   translation. Strictly speaking, ISO-8859-1 is *different* than Windows
88   code page 1252 or MacRoman. Upon quick inspection one will notice that
89   many of the letters do occupy the same positions in each of their'
90   respective encoding tables, so it is easy to understand how people can
91   make this false assumption.
92
93
94 Word Reordering
95 ---------------
96 Different languages have different word ordering requirements. When a
97 key word such as a person's name needs to be added to the end of a
98 sentence in english, there is no guarantee that the same word will
99 appear at the end of a sentence once translated to another language.
100
101 PhpWiki has been designed with this in mind. (Standard printf
102 notations like %s and %1$s, %2$s will work with PhpWiki, even though
103 reordering of variable-substitutions is not actually part of PHP).
104 (The printf(3) manual page on your system may be of some help.)
105
106
107 Take the following English phrase as an example. This message would be
108 displayed in the browser when someone wants to compare two revisions
109 of a Wiki page. The corresponding entry for the German translation for
110 this phrase (from the file 'de.po') reads:
111  
112     #: ../lib/diff.php:251
113     #, c-format
114     msgid "Differences between %s and %s of %s."
115     msgstr "Der Unterschiedsergebnis von %3$s, zwischen %1$s und %2$s"
116
117 In the English version, PhpWiki will substitute the phrases "version
118 1", "version 2" and the name of the page being compared. The
119 placeholder '%s' indicates where text will later be substituted, while
120 '%d' is used to indicate a number will be inserted.
121
122 Sentence structure of German is different than English, and this case
123 dictates that the "page name" must come first, then followed by
124 "Verson 1." and finally "Version 2."
125
126 To summarize, when the word ordering must differ, insert "1$", "2$"
127 etc. into the middle of '%s' and repeat for each instance of '%s' in
128 the phrase.  If you use this "$" notation, you must use it for each
129 of the the format specifications within the string.
130
131 Here are a couple more examples. They are fictional but they serve to
132 illustrate how to handle special cases, should they arise:
133
134
135 #msgid "Page version '%d' named '%s' is not available."
136 #msgstr "Xyqlmn vvvm » %2$s « mnqee » %1$d « Gvbbbnbhkkk eeek."
137
138 The %s and %d are reversed, so '2$' and '1$' have been used to
139 indicate the new ordering. The punctuation marks for this language
140 dictate extra spacing, so this has also been accounted for in the
141 translation (i.e. the quote marks are only for emphasis, they are not
142 considered part of the %s placeholder).
143
144
145 #msgid "Page named '%s' version '%d' written by author '%s' is not available."
146 #msgstr "Qppn wwmoooppp '%3$s' vvvm '%1$s' mnqee '%2$d' Gvbbbnbhkkk eeek."
147
148 Name and author are reversed. Even though the position of the number
149 ('%d') isn't changed, still it must be changed to '%2$d' --- if you
150 use a '$' on one of the format specifiers you must use it on all of
151 them.  The punctuation for this particular language is the same as
152 english so it is unchanged.
153
154
155 While translating the text strings if you are uncertain about the
156 syntax, look at the '.po' files of the other languages as an
157 example. If you are stuck or simply can't make any sense of all this,
158 just ask one of the PhpWiki programmers on the mailing list to help
159 out.
160
161 The 'phpwiki.php' files do not need to be created or edited because
162 the Makefile will create and update these files automatically. See the
163 'Makefile' section below.
164
165
166 Default Pages
167 -------------
168 Most of the work will be in the translation of the default pgsrc
169 files. As a starting point you can copy the English 'pgsrc' directory:
170
171     mkdir locale/is
172     cp -rv pgsrc locale/is
173
174 For these 'pgsrc' files it will be sufficient to change the page names
175 to Islandic, and maybe translate the HomePage and give it an Islandic
176 name. Again, for anything you don't know, look at the 'nl' or 'de'
177 versions.
178
179 The best approach to translating the default page content is to do all
180 of your page editing in the web browser itself, then perform a page
181 dump to save the pages as MIME text files.  Some of the pages are
182 locked so you will have to log into PhpWiki as the administrator
183 before you can edit them.
184
185 <FIXME>
186    Add instructions for editing MIME headers of files before moving
187    files into '/locale/is/pgsrc'
188
189  - keep modification date, page name and lock, remove author.
190    Example:
191
192    Date: Sun, 27 Jan 2002 17:28:55 -0500
193    Mime-Version: 1.0 (Produced by PhpWiki 1.3.2-jeffs-hacks)
194    X-Rcs-Id: $Id: README,v 1.10 2003-01-29 21:50:25 carstenklapp Exp $
195    Content-Type: application/x-phpwiki;
196      pagename=FrischeSeiten;
197      flags=PAGE_LOCKED;
198      charset=iso-8859-1
199    Content-Transfer-Encoding: binary
200
201  - Make sure to rename files with accents in the page name converted
202    to uppercase hex codes as shown in the pagename= line of the
203    Content-Type header.
204
205    (e.g. "GästeBuch" => "G%E4steBuch")
206
207  - Translate body text and rename plugin pages to match changes
208    specified in the '.po' file. Leave plugin code as english.
209    Example:
210
211    <?plugin RecentChanges days||=30 show_all||=0 show_minor||=0 ?>
212
213 </FIXME>
214
215
216 Makefile
217 -------- 
218 The Makefile calls 'xgettext' to automatically perform a number of
219 important translation tasks:
220
221  * Scans through all the source code and retrieves the english
222    strings used as text arguments, then collects and indexes them into
223    the file 'phpwiki.pot'.
224
225  * Merges any new differences of the collected English text strings
226    with similar text strings found during any previous runs of 'make',
227    stored inside each of the translated '.po' files.
228
229  * Makes note of which English text strings have been added, reworded
230    or removed. The translated strings in the '.po' files are then marked
231    as "Fuzzy" translations for all cases where the English text has been
232    changed. This makes it easy for translators to spot which items need
233    to be updated. (Emacs' po mode also uses this information).
234
235  * The necessary '.mo' files and 'phpwiki.php' text files are
236    synchronized and sorted according to the translated contents of the
237    '.po' files, for each of the locale subdirectories.
238
239 When a new language module is added to PhpWiki, the 'Makefile' in the
240 'locale' folder also needs to be updated. The process:
241
242  0. Change into the locale directory (if you're not already there.)
243
244  1. If there isn't one already, Create a new .po (in the po/ subdirectory)
245     for your translations:
246
247       cp po/phpwiki.pot po/xx.po
248
249     where 'xx' should be the two letter character code for the language
250     you are translating to.
251
252  2. If you've created a new .po file (or if there are new .php source files
253     containing translatable strings,) update the Makefile:
254  
255       make dep
256
257  3. To make sure the list of translatable strings in the .po is in sync
258     with the actual php source code:
259  
260       make po
261
262  4. Edit the translations in the .po file.  If you have emacs available,
263     emacs' po-mode is very helpful when doing this.
264
265  5. To update the compiled translation (.mo) files:
266
267       make
268
269 Make will then automatically generate and update all the necessary
270 files. If this step fails because you don't have the necessary
271 software installed, then send your '.po' files to one of the PhpWiki
272 developers who will run Makefile for you.
273
274
275 NOTE: "Fuzzy" translations will NOT be included in the final '.mo' and
276 'phpwiki.php' files. If you are not using the emacs editor, make sure
277 to remove the fuzzy marks from any *completed translations* before you
278 run the makefile, like this:
279
280     #: ../lib/plugin/BackLinks.php:44
281     #, fuzzy, c-format
282     msgid "These pages link to %s:"
283     msgstr "%d pages pointent vers %s."
284
285 should become:
286
287     #: ../lib/plugin/BackLinks.php:44
288     #, c-format
289     msgid "These pages link to %s:"
290     msgstr "%d pages pointent vers %s."
291
292 and...
293
294     #: ../lib/Toolbar.php:160 ../templates/browse.html:54
295     #, fuzzy
296     msgid "Lock page"
297     msgstr "Bloquear página"
298
299 should become:
300
301     #: ../lib/Toolbar.php:160 ../templates/browse.html:54
302     msgid "Lock page"
303     msgstr "Bloquear página"
304
305
306 HTML Templates
307 --------------
308 The template files do not need to be translated. As of PhpWiki 1.3 all
309 the text strings in the html templates are cross-referenced with the
310 translations in the '.po' files.
311
312 *** Note: Updating html template translations from PhpWiki 1.2 to 1.3: ***
313
314 The translated version of the tips for TextFormattingRules must be
315 moved from the old html template 'editpage.html', and placed into the
316 'pgsrc' for the default page of TextFormattingRules. A plugin now
317 extracts this text and inserts it when editing a page in PhpWiki,
318 rather than it being embedded within the html template itself.
319
320 It is suggested this paragraph would go at the top of the page. It
321 must be in a section heading entitled "Summary" in order for the
322 editpage template to find it. Of course you will substitute the
323 translations for "TextFormattingRules" and "Summary", according to the
324 wording you used for these phrases when you translated the '.po' file.
325
326 Refer to the English "TextFormattingRules" and German (de)
327 "TextFormatierungsRegeln" pages to see working examples.
328
329
330 Finale
331 ======
332 After you have finished translating, you will want to see the result
333 of your efforts. Change the $LANG setting in 'index.php' to the
334 two-letter code for your language.
335
336 Et voilà, Phpwiki should now speak Islandic!
337
338 If your translation was a success, you may also want to add a
339 translation of these instructions for translating PhpWiki ;-)
340
341 About gettext
342 -------------
343 To learn more about GNU gettext and '.po' files, you may find some
344 information at:
345
346     <http://www.iro.umontreal.ca/contrib/po/HTML/>
347     <http://www.gnu.org/directory/gettext>
348
349 Good luck,
350 Jan Nieuwenhuizen <janneke@gnu.org>
351 Arno Hollosi <ahollosi@mail.com>
352 Carsten Klapp <carstenklapp@users.sourceforge.net>
353
354 $Id: README,v 1.10 2003-01-29 21:50:25 carstenklapp Exp $