fix GNU gettext locale finding
This commit is contained in:
parent
928bf04e1f
commit
a2a37745d8
47
src/main.cpp
47
src/main.cpp
|
@ -48,6 +48,7 @@ struct sigaction termsa;
|
||||||
#define TUT_INTRO_PLAYED false
|
#define TUT_INTRO_PLAYED false
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_LOCALE
|
||||||
#ifdef HAVE_MOMO
|
#ifdef HAVE_MOMO
|
||||||
#define TA_BINDTEXTDOMAIN momo_bindtextdomain
|
#define TA_BINDTEXTDOMAIN momo_bindtextdomain
|
||||||
#define TA_TEXTDOMAIN momo_textdomain
|
#define TA_TEXTDOMAIN momo_textdomain
|
||||||
|
@ -66,6 +67,7 @@ struct sigaction termsa;
|
||||||
#ifndef LC_MESSAGES
|
#ifndef LC_MESSAGES
|
||||||
#define LC_MESSAGES 1
|
#define LC_MESSAGES 1
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "cli/cli.h"
|
#include "cli/cli.h"
|
||||||
|
|
||||||
|
@ -109,6 +111,19 @@ bool infoMode=false;
|
||||||
|
|
||||||
std::vector<TAParam> params;
|
std::vector<TAParam> params;
|
||||||
|
|
||||||
|
#ifdef HAVE_LOCALE
|
||||||
|
char localeDir[4096];
|
||||||
|
|
||||||
|
const char* localeDirs[]={
|
||||||
|
"locale",
|
||||||
|
"../po/locale",
|
||||||
|
#ifdef LOCALE_DIR
|
||||||
|
LOCALE_DIR,
|
||||||
|
#endif
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
TAParamResult pHelp(String) {
|
TAParamResult pHelp(String) {
|
||||||
printf("usage: furnace [params] [filename]\n"
|
printf("usage: furnace [params] [filename]\n"
|
||||||
"you may specify the following parameters:\n");
|
"you may specify the following parameters:\n");
|
||||||
|
@ -546,27 +561,27 @@ int main(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((localeRet=TA_BINDTEXTDOMAIN("furnace","locale"))==NULL) {
|
bool textDomainBound=false;
|
||||||
if ((localeRet=TA_BINDTEXTDOMAIN("furnace","../po/locale"))==NULL) {
|
for (int i=0; localeDirs[i]; i++) {
|
||||||
#ifdef LOCALE_DIR
|
strncpy(localeDir,localeDirs[i],4095);
|
||||||
if ((localeRet=TA_BINDTEXTDOMAIN("furnace",LOCALE_DIR))==NULL) {
|
logV("bind text domain: %s",localeDir);
|
||||||
logE("could not bind text domain!");
|
if (!dirExists(localeDir)) continue;
|
||||||
} else {
|
if ((localeRet=TA_BINDTEXTDOMAIN("furnace",localeDir))==NULL) {
|
||||||
logV("text domain 1: %s",localeRet);
|
continue;
|
||||||
}
|
|
||||||
#else
|
|
||||||
logE("could not bind text domain!");
|
|
||||||
#endif
|
|
||||||
} else {
|
} else {
|
||||||
|
textDomainBound=true;
|
||||||
logV("text domain 1: %s",localeRet);
|
logV("text domain 1: %s",localeRet);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
logV("text domain 1: %s",localeRet);
|
|
||||||
}
|
}
|
||||||
if ((localeRet=TA_TEXTDOMAIN("furnace"))==NULL) {
|
if (!textDomainBound) {
|
||||||
logE("could not text domain!");
|
logE("could not bind text domain!");
|
||||||
} else {
|
} else {
|
||||||
logV("text domain 2: %s",localeRet);
|
if ((localeRet=TA_TEXTDOMAIN("furnace"))==NULL) {
|
||||||
|
logE("could not text domain!");
|
||||||
|
} else {
|
||||||
|
logV("text domain 2: %s",localeRet);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue