Chapter 11. Libraries and Components
89
When two or more '%' directive for formatted output functions such as
printf()
appear in a
message, the order of these '%' directives may be changed by translation. In such a case, the
translator can specify the order. See section of 'Special Comments preceding Keywords' in info
page of
gettext
for detail.
Now there are projects to translate messages in various softwares. For example, Translation Project
(
http://www.iro.umontreal.ca/~pinard/po/HTML/
).
11.1.1 Gettext ization of A Software
At first, the software has to have the following lines.
int main(int argc, char **argv)
{
...
setlocale (LC_ALL, "");
/* This is not for gettext but
all i18n software should have
this line. */
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
...
}
where PACKAGE is the name of the catalog file and LOCALEDIR is
/usr/share/locale
for
Debian. PACKAGE and LOCALEDIR should be defined in a header file or
Makefile
.
It is convenient to prepare the following header file.
#include
#define _(String) gettext((String))
and messages in source files should be written as
_( message )
, instead of
message
.
Next, catalog files have to be prepared.
At first, a template for catalog file is prepared using
xgettext
. At default a template file
message.po
is prepared.
1
1
I HAVE TO WRITE EXPLANATION.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Inexpensive Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Jsp Hosting
Cheap Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved