Mercurial > pyntnclick
comparison README-i18n.txt @ 769:43b49f1de828 pyntnclick-i18n
Merge i18n for before the pyntnclick split
author | Stefano Rivera <stefano@rivera.za.net> |
---|---|
date | Sat, 26 Jan 2013 16:57:33 +0200 |
parents | 4ea237bbcef8 |
children | eafa66caedd2 |
comparison
equal
deleted
inserted
replaced
763:afe7b1cb16c0 | 769:43b49f1de828 |
---|---|
1 These are notes on internationalization and translation. They are | |
2 suitable for Unix like systems. As prerequisites you need `gettext' | |
3 being installed and (if you want to translate) some editor for | |
4 gettext catalogs like `poedit' or `virtaal'. In case you are familiar | |
5 with gettext ".po" format any text editor will do. | |
6 | |
7 | |
8 == How do I translate suspended-sentence into my language? == | |
9 | |
10 First of all look if there is already translation catalog for | |
11 your locale in `po/' subdirectory. The file should be named like | |
12 `<locale>.po' where <locale> is the language code for your locale. | |
13 For example, catalog for German is called `de.po'. If it is there | |
14 you can start translating. | |
15 | |
16 If there is no file for your locale you need to generate it. To do | |
17 this navigate to the `po/' directory in terminal and type command | |
18 | |
19 msginit -l <locale> | |
20 | |
21 where <locale> is two-letters-language-code you need. Then translate | |
22 generated file using your preferred editor. | |
23 | |
24 To get new translation to work you need to compile and install it by | |
25 executing `install-po.sh' script. | |
26 | |
27 | |
28 == How can I mark the string in code as translatable? == | |
29 | |
30 Just surround it with _( and ) like | |
31 "Hello, world" -> _("Hello, world!") | |
32 | |
33 _() is a function in `gamelib/i18n.py' file, so you might want to | |
34 import it first. | |
35 | |
36 from gamelib.i18n import _ | |
37 | |
38 And don't forget to update message catalogs with new strings. To do | |
39 that just execute `update-po.sh' script. It collects all translatable | |
40 strings from files that are specified in `po/POTFILES'. Make sure the | |
41 file you worked on is in there. |