vendredi 17 avril 2015

C++ gettext doesn't translate (Windows 8.1)

I tried almost all solutions I found on web/stackoverflow.


The problem is, that gettext doesn't translate my text in C++(11).


Here is my shortened code:



#include "gettext.h"

std::string locale(setlocale(LC_ALL, ""));
MessageBoxA(NULL, locale.c_str(), "Locale", MB_OK); // prints out 'German_Germany.1252'
std::string lclocale = "LC_ALL=" + locale";

if(0 == putenv(lclocale.c_str()))
MessageboxA(NULL, "Set locale seccussful", "Locale", MB_OK);
else
MessageboxA(NULL, "Set locale error", "Locale", MB_OK);

std::string domain("xyz_locale");
textdomain(domain.c_str());
bindtextdomain(domain.c_str(), "./xyz_locale");
bind_textdomain_codeset(domain.c_str(), "UTF-8"); // same problem without this line


What I already tried:



  • Set locale (LC_ALL) manually to

    • de

    • german

    • de_DE

    • German_Germany.1252




Here is my directory structure for locale:



pathToDomain
/(locale) //tried all names mentioned above
/LC_MESSAGES
/(domain).mo


I already tried to set path absolute ("C:/....../(domain)")


Translation(-files) are made with PoEdit. *.po files are encodet with UTF-8, line endings are set to windows (setting in PoEdit).


I've downloaded gettext stuff from here:



but there is no difference in result with them.


I copied gettext.h from gettext-tools-dev_0.18.1.1-2.win32/share/gettext to /include directory of my project.


Edit:


I already read through gettext windows FAQ


Aucun commentaire:

Enregistrer un commentaire