1
1
HOWTO translate GRASS messages
2
2
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
4
$Date: 2009-05-20 23:14:50 +0200 (Wed, 20 May 2009) $
4
This file contains following sections:
5
1. Instructions for programmers;
6
2. A translation workflow overview;
7
3. A detailed explanation of translation workflow, testing;
8
4. Some notes and links
6
10
[ Web page: http://grass.osgeo.org/devel/i18n.php ]
48
52
NOTE2: Also the parameters/flags of each module needs the
55
NOTE3: Notices to translators can be added by placing
56
a comment line starting with GTC tag just above
57
message to be translated:
58
/* GTC A comma separated keyword list.
59
Should not contain spaces! */
60
keywords = _("first,second,third");
62
NOTE4: Any string containing a number that requires a correct plural form of
63
a noun, has to pass trough ngettext function implemented in GRASS
65
_n("Message in English for singular case", "Message in English for
68
Examples of messages with plural forms.
70
G_message( _("%d map(s) from mapset <%s> removed"), n, ms);
71
G_message( n == 1 ? _("One file removed") : _("%d files removed"), n);
72
G_warning( _("%d %s without geometry skipped"), n,
73
n == 1 ? "feature" : "features");
74
G_message( _("%d maps selected"), n);
75
G_message( n == 1 ? _("Remove map") : _("Remove maps"));
78
G_message( _n("%d map from mapset <%s> removed",
79
"%d maps from mapset <%s> removed", n), n, ms);
80
/* Notice double use of number "n" - as an argument for
81
both functions - _n() and G_message() */
82
G_message( _n("One file removed", "%d files removed", n) n);
83
/* Both of forms of singular case "%d file" or "One file" are correct.
84
The choice between them is purely stylistic one. */
85
G_warning( _n("One feature without geometry skipped",
86
"%d features without geometry skipped", n), n);
87
G_message( _n("%d map selected", "%d maps selected", n), n);
88
/* Altough in English it is not necessary to provide a separate
89
text if "n" always is >1, in other languages is a difference if "n"
90
is i.e. 2-4, or n==10 etc. */
91
G_message( _n("Remove map", "Remove maps", n));
92
/* Number it self doesn't have to be used in the output text */
51
95
All these messages strings will be then automatically
52
96
extracted into the message files.
54
98
See for example ./vector/v.what.rast/main.c
57
101
fprintf (stdout,"\n");
58
102
do not need a change as no translation is needed.
104
A detailed example of adapting code for use in multiple languages
105
can be found in gettext manual.
106
How to prepare program source:
107
http://www.gnu.org/software/gettext/manual/gettext.html#Sources
109
More advanced tricks like resolving ambiguties and handling of plural forms:
110
http://www.gnu.org/software/gettext/manual/gettext.html#Programmers
61
112
------------------------------------------------------
191
240
Run 'kbabel' or equivalent program
192
241
kbabel ./po/grasslibs_<LANGUAGE>.po
193
242
kbabel ./po/grassmods_<LANGUAGE>.po
194
kbabel ./po/grasstcl_<LANGUAGE>.po
195
243
kbabel ./po/grasswxpy_<LANGUAGE>.po
197
245
For example (German):
198
246
kbabel ./po/grasslibs_de.po
199
247
kbabel ./po/grassmods_de.po
200
kbabel ./po/grasstcl_de.po
201
248
kbabel ./po/grasswxpy_de.po
203
250
KBABEL: You may load .po files from other projects [see footnote 1].