annotate README-i18n.txt @ 820:e42d19c2237b pyntnclick

Add InteractText and InteractUnion
author Neil Muller <neil@dip.sun.ac.za>
date Mon, 28 Jan 2013 18:19:44 +0200
parents eafa66caedd2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
478
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
1 These are notes on internationalization and translation. They are
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
2 suitable for Unix like systems. As prerequisites you need `gettext'
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
3 being installed and (if you want to translate) some editor for
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
4 gettext catalogs like `poedit' or `virtaal'. In case you are familiar
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
5 with gettext ".po" format any text editor will do.
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
6
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
7
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
8 == How do I translate suspended-sentence into my language? ==
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
9
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
10 First of all look if there is already translation catalog for
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
11 your locale in `po/' subdirectory. The file should be named like
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
12 `<locale>.po' where <locale> is the language code for your locale.
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
13 For example, catalog for German is called `de.po'. If it is there
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
14 you can start translating.
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
15
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
16 If there is no file for your locale you need to generate it. To do
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
17 this navigate to the `po/' directory in terminal and type command
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
18
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
19 msginit -l <locale>
479
4ea237bbcef8 Tidy up the i18n changes
Stefano Rivera <stefano@rivera.za.net>
parents: 478
diff changeset
20
478
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
21 where <locale> is two-letters-language-code you need. Then translate
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
22 generated file using your preferred editor.
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
23
479
4ea237bbcef8 Tidy up the i18n changes
Stefano Rivera <stefano@rivera.za.net>
parents: 478
diff changeset
24 To get new translation to work you need to compile and install it by
478
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
25 executing `install-po.sh' script.
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
26
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
27
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
28 == How can I mark the string in code as translatable? ==
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
29
783
eafa66caedd2 Fix trailing space and old reference to gamelib.i18n.
Simon Cross <hodgestar@gmail.com>
parents: 479
diff changeset
30 Just surround it with _( and ) like
478
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
31 "Hello, world" -> _("Hello, world!")
479
4ea237bbcef8 Tidy up the i18n changes
Stefano Rivera <stefano@rivera.za.net>
parents: 478
diff changeset
32
4ea237bbcef8 Tidy up the i18n changes
Stefano Rivera <stefano@rivera.za.net>
parents: 478
diff changeset
33 _() is a function in `gamelib/i18n.py' file, so you might want to
4ea237bbcef8 Tidy up the i18n changes
Stefano Rivera <stefano@rivera.za.net>
parents: 478
diff changeset
34 import it first.
478
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
35
783
eafa66caedd2 Fix trailing space and old reference to gamelib.i18n.
Simon Cross <hodgestar@gmail.com>
parents: 479
diff changeset
36 from pyntnclick.i18n import _
478
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
37
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
38 And don't forget to update message catalogs with new strings. To do
a9925aaf5f61 i18n and Russian translation
Stefano Rivera <stefano@rivera.za.net>
parents:
diff changeset
39 that just execute `update-po.sh' script. It collects all translatable
479
4ea237bbcef8 Tidy up the i18n changes
Stefano Rivera <stefano@rivera.za.net>
parents: 478
diff changeset
40 strings from files that are specified in `po/POTFILES'. Make sure the
4ea237bbcef8 Tidy up the i18n changes
Stefano Rivera <stefano@rivera.za.net>
parents: 478
diff changeset
41 file you worked on is in there.