Hi,
When I execute the following, my hello world text is not translated. What am
I doing wrong? Do I need something set up or installed before I can test the
de_DE locale?
Thanks,
Steve.
kde-de...@bishop:~/kde/src/playground/gettext_test$ vi main.cpp
kde-de...@bishop:~/kde/src/playground/gettext_test$ g++ -o main main.cpp
kde-de...@bishop:~/kde/src/playground/gettext_test$ ./main
Hello World
kde-de...@bishop:~/kde/src/playground/gettext_test$ cat main.cpp
#include<libintl.h>
#include<locale.h>
#include<stdio.h>
int main(int argc, char **argv)
{
setlocale(LC_ALL, "");
char *btd = bindtextdomain("i18n", "/home/kde-
devel/kde/src/playground/gettext_test");
char *td = textdomain("i18n");
printf(gettext("Hello World\n"));
return 0;
}
kde-de...@bishop:~/kde/src/playground/gettext_test$ mkdir -p
de_DE/LC_MESSAGES
kde-de...@bishop:~/kde/src/playground/gettext_test$ xgettext -d i18n -o
i18n.pot -s main.cpp
kde-de...@bishop:~/kde/src/playground/gettext_test$ cp i18n.pot de_DE.po
kde-de...@bishop:~/kde/src/playground/gettext_test$ vi de_DE.po
kde-de...@bishop:~/kde/src/playground/gettext_test$ cat de_DE.po
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <em...@address>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-11-03 23:41+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <em...@address>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: main.cpp:14
#, c-format
msgid "Hello World\n"
msgstr "Hallo, Welt\n"
kde-de...@bishop:~/kde/src/playground/gettext_test$ msgfmt de_DE.po -o
de_DE/LC_MESSAGES/i18n.mo
de_DE.po: warning: Charset "CHARSET" is not a portable encoding name.
Message conversion to user's charset might not work.
kde-de...@bishop:~/kde/src/playground/gettext_test$ LANG=de_DE ./main
Hello World