| An Internationalized Software Project With Auto Tools | ||
|---|---|---|
| Prev | Using gettext | Next |
# gmake update-po ... |
# cat po/POTFILES.in ./src/main.cpp ./src/testmodule/testfunc.cpp |
# cat po/testproj.pot # SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR James T. # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR |
# touch po/LINGUAS |
po/LINGUAS |
de |
# cp po/testproj.pot po/de.po |
po/de.po |
... |
# touch po/POTFILES.in # gmake update-po ... gmake[2]: Entering directory `/usr/home/he/develop/testproj/po' de: msgmerge de.po testproj.pot -o de.new.po . done. gmake[2]: Leaving directory `/usr/home/he/develop/testproj/po' gmake update-gmo gmake[2]: Entering directory `/usr/home/he/develop/testproj/po' rm -f de.gmo && /usr/local/bin/msgfmt -c --statistics -o de.gmo de.po 2 translated messages. gmake[2]: Leaving directory `/usr/home/he/develop/testproj/po' gmake[1]: Leaving directory `/usr/home/he/develop/testproj/po' |
# gmake install ... Making install in po gmake[1]: Entering directory `/usr/home/he/develop/testproj/po' ... /bin/sh .././mkinstalldirs /usr/local/share installing de.gmo as /usr/local/share/locale/de/LC_MESSAGES/testproj.mo ... |
# testproj hello world! Press a key |
# setenv LC_ALL de_DE.ISO8859-1 ; testproj ; unsetenv LC_ALL hallo welt! Drücken Sie eine Taste |
# LC_ALL=de_DE.ISO8859-1 ; export LC_ALL ; testproj ; unset LC_ALL hallo welt! Drcken Sie eine Taste # LC_ALL=de_DE.UTF-8 ; export LC_ALL ; testproj ; unset LC_ALL hallo welt! Drücken Sie eine Taste |
src/testmodule/testfunc.cpp |
#include <stdio.h>
#include "testfunc.h"
#include "../i18n.h"
void printMessage()
{
printf(i18n("Hello world!\n"));
printf(i18n("Press a key\n"));
getchar();
}
|
src/main.cpp |
#include <stdio.h>
#include <locale.h>
#include "testmodule/testfunc.h"
#include "i18n.h"
int main(int)
{
setlocale (LC_ALL, "");
bindtextdomain (PACKAGE, LOCALEDIR);
textdomain (PACKAGE);
printMessage();
printf(i18n("Bye\n"));
}
|
# gmake update-po ... |
# gmake ... |
# gmake force-update-gmo touch po/*.po cd po && gmake update-gmo gmake[1]: Entering directory `/usr/home/he/develop/testpr/testproj-0.1/po' rm -f de.gmo && /usr/local/bin/msgfmt -c --statistics -o de.gmo de.po 1 translated message, 1 fuzzy translation, 1 untranslated message. gmake[1]: Leaving directory `/usr/home/he/develop/testpr/testproj-0.1/po' |
# gmake dist-bzip2 ... |
# bunzip2 testproj-0.1.tar.bz2 # tar -xf testproj-0.1.tar # cd testproj-0.1 # ./configure ... # gmake ... |
# gmake update-po ... |
# gmake force-update-gmo-de gmake[1]: Entering directory `/usr/home/he/develop/testpr/testproj-0.1/po' rm -f de.gmo && /usr/local/bin/msgfmt -c --statistics -o de.gmo de.po 1 translated message, 1 fuzzy translation, 1 untranslated message. gmake[1]: Leaving directory `/usr/home/he/develop/testpr/testproj-0.1/po' |
po/de.po |
... #: src/main.cpp:11 msgid "Bye\n" msgstr "Auf Wiedersehen\n" #: src/testmodule/testfunc.cpp:7 |
# gmake update-gmo gmake[2]: Entering directory `/usr/home/he/develop/testproj-0.1/testproj-0.1/po' rm -f de.gmo && /usr/local/bin/msgfmt -c --statistics -o de.gmo de.po 3 translated messages. gmake[2]: Leaving directory `/usr/home/he/develop/testproj-0.1/testproj-0.1/po' |
# gmake install ... |
# testproj Hello world! Press a key Bye # setenv LC_ALL de_DE.ISO8859-1 ; testproj ; unsetenv LC_ALL Hallo Welt! Drücken Sie eine Taste Auf Wiedersehen |
# gmake force-update-gmo ... |
| Prev | Home | Next |
| Adding gettext Support | Internationalization Tips |