3

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

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

1
  • I have same problem in a simple C hello world application (based in this article) and I've tried all steps above, however it doesn't work here too. Any string is translated, no logs, no errors, no problem compiling/linking. I still trying to solve it.
    – silvioprog
    Dec 11, 2016 at 20:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.