From: Yves <yme...@pe...> - 2005-02-17 08:33:00
|
>>> ii) This does not break the current translation. I note we have >>> several German / French users. I don't want to loose them >>> if possible :) Ben, if things are done correctly, there is no problem for translations. = Alex's issue is about keywords, not translations. 2 distinct keywords make 2 strings to t= ranslate :) > How are this translation done for the language, hardcoded? Alex, when you write one of _("string to translate") N_("string to translate") gettext tools can find the string "string to translate" and put it in po/= perfparse.pot. Then, translators copy that file (if not done already) with the name fr.p= o (for french) or de.po (for german) or whatever the language is. Then they edit it, and= the previous becomes (for french) : msgid "string to translate" msgstr "cha=EEne =E0 traduire" Gettext tools compute those .po files and generate .gmo files, that are r= enamed at installation time. Check /usr/share/locale/... or something similar. Translation is done at runtime. Change your $LANG environment variable an= d the program will talk another language. > #ifdef USE_LANGUAGE_ENGLISH > #define TXT_001 N_("Please select the Host from list:") > #define TXT_002 N_("...:") > #elseif USE_LANGUAGE_FRENCH > #define TXT_001 N_("Please select the Host from list:") > #define TXT_002 N_("...:") > #elseif USE_LANGUAGE_GERMAN > #define TXT_001 N_("Please select the Host from list:") > #define TXT_002 N_("...:") > #endif Some infos about gettext : in some header file, you should be able to fin= d this : #define N_(x) (x) #define _(x) gettext(x) char*gettext(const char*msgid) { 1/ get the $LANG variable 2/ read the $LANG.po file (in real, it is not $LANG.po but /usr/share/locale/.../$LANG/.../perfparse.mo) 3/ find msgid in that file 4/ read the msgstr that comes with that msgid return(msgstr); } The only things to remember are : use _(string) to have a translatable string use N_(string) when you define a keyword like #define KEY N_("keyword") a= nd use _(KEY) then (because N_(string) does nothing). That's all :) More info on http://www.gnu.org/software/gettext/manual/html_chapter/gett= ext_toc.html --=20 - Homepage - http://ymettier.free.fr - http://www.logicacmg.com - - GPG key - http://ymettier.free.fr/gpg.txt - - Maitretarot - http://www.nongnu.org/maitretarot/ - - Perfparse - http://www.perfparse.org/ - |