From 64f931e895dcd4c3b5fc358d3225e2a769b62736 Mon Sep 17 00:00:00 2001 From: tildearrow Date: Wed, 19 Jun 2024 13:43:28 -0500 Subject: [PATCH] do not set locale if it's English --- src/gui/settings.cpp | 2 +- src/main.cpp | 108 ++++++++++++++++++++++--------------------- 2 files changed, 56 insertions(+), 54 deletions(-) diff --git a/src/gui/settings.cpp b/src/gui/settings.cpp index 770d60b21..1afccdd7e 100644 --- a/src/gui/settings.cpp +++ b/src/gui/settings.cpp @@ -79,7 +79,7 @@ const char* locales[][3]={ //{"Français (0%)", "fr_FR", "redémarrer Furnace pour que ce réglage soit effectif."}, //{"Հայերեն (1%)", "hy_AM", "???"}, //{"日本語 (0%)", "ja_JP", "???"}, - //{"한국어 (10%)", "ko_KR", "이 설정을 적용하려면 Furnace를 다시 시작해야 합니다."}, + {"한국어 (10%)", "ko_KR", "이 설정을 적용하려면 Furnace를 다시 시작해야 합니다."}, //{"Nederlands (4%)", "nl_NL", "start Furnace opnieuw op om deze instelling effectief te maken."}, {"Polski (90%)", "pl_PL", "aby to ustawienie było skuteczne, należy ponownie uruchomić program."}, {"Português (Brasil) (90%)", "pt_BR", "reinicie o Furnace para que essa configuração entre em vigor."}, diff --git a/src/main.cpp b/src/main.cpp index 9c4bd4d78..2e3efaa52 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -555,74 +555,76 @@ int main(int argc, char** argv) { reqLocale+=".UTF-8"; } } - const char* localeRet=NULL; + if (reqLocale!="en_US.UTF-8") { + const char* localeRet=NULL; #ifdef HAVE_SETLOCALE - if ((localeRet=setlocale(LC_CTYPE,reqLocale.c_str()))==NULL) { - logE("could not set locale (CTYPE)!"); - displayLocaleFailError=true; - } else { - logV("locale: %s",localeRet); - } - if ((localeRet=setlocale(LC_MESSAGES,reqLocale.c_str()))==NULL) { - logE("could not set locale (MESSAGES)!"); - displayLocaleFailError=true; -#ifdef HAVE_MOMO - if (momo_setlocale(LC_MESSAGES,reqLocale.c_str())==NULL) { - logV("Momo: could not set locale!"); + if ((localeRet=setlocale(LC_CTYPE,reqLocale.c_str()))==NULL) { + logE("could not set locale (CTYPE)!"); + displayLocaleFailError=true; + } else { + logV("locale: %s",localeRet); } -#endif - } else { - logV("locale: %s",localeRet); + if ((localeRet=setlocale(LC_MESSAGES,reqLocale.c_str()))==NULL) { + logE("could not set locale (MESSAGES)!"); + displayLocaleFailError=true; #ifdef HAVE_MOMO - if (momo_setlocale(LC_MESSAGES,localeRet)==NULL) { - logV("Momo: could not set locale!"); - } + if (momo_setlocale(LC_MESSAGES,reqLocale.c_str())==NULL) { + logV("Momo: could not set locale!"); + } #endif - } + } else { + logV("locale: %s",localeRet); +#ifdef HAVE_MOMO + if (momo_setlocale(LC_MESSAGES,localeRet)==NULL) { + logV("Momo: could not set locale!"); + } +#endif + } #else - if ((localeRet=momo_setlocale(LC_MESSAGES,reqLocale.c_str()))==NULL) { - logV("Momo: could not set locale!"); - } else { - logV("locale: %s",localeRet); - } + if ((localeRet=momo_setlocale(LC_MESSAGES,reqLocale.c_str()))==NULL) { + logV("Momo: could not set locale!"); + } else { + logV("locale: %s",localeRet); + } #endif - char exePath[4096]; + char exePath[4096]; #ifdef ANDROID - memset(exePath,0,4096); + memset(exePath,0,4096); #else - if (!getExePath(argv[0],exePath,4096)) memset(exePath,0,4096); + if (!getExePath(argv[0],exePath,4096)) memset(exePath,0,4096); #endif - bool textDomainBound=false; - for (int i=0; localeDirs[i]; i++) { - if (exePath[0]!=0 && localeDirs[i][0]!=DIR_SEPARATOR) { - strncpy(localeDir,exePath,4095); - strncat(localeDir,DIR_SEPARATOR_STR,4095); - strncat(localeDir,localeDirs[i],4095); - } else { - strncpy(localeDir,localeDirs[i],4095); + bool textDomainBound=false; + for (int i=0; localeDirs[i]; i++) { + if (exePath[0]!=0 && localeDirs[i][0]!=DIR_SEPARATOR) { + strncpy(localeDir,exePath,4095); + strncat(localeDir,DIR_SEPARATOR_STR,4095); + strncat(localeDir,localeDirs[i],4095); + } else { + strncpy(localeDir,localeDirs[i],4095); + } + logV("bind text domain: %s",localeDir); + if (!dirExists(localeDir)) continue; + if ((localeRet=TA_BINDTEXTDOMAIN("furnace",localeDir))==NULL) { + continue; + } else { + textDomainBound=true; + logV("text domain 1: %s",localeRet); + break; + } } - logV("bind text domain: %s",localeDir); - if (!dirExists(localeDir)) continue; - if ((localeRet=TA_BINDTEXTDOMAIN("furnace",localeDir))==NULL) { - continue; + if (!textDomainBound) { + logE("could not bind text domain!"); } else { - textDomainBound=true; - logV("text domain 1: %s",localeRet); - break; + if ((localeRet=TA_TEXTDOMAIN("furnace"))==NULL) { + logE("could not text domain!"); + } else { + logV("text domain 2: %s",localeRet); + } } - } - if (!textDomainBound) { - logE("could not bind text domain!"); - } else { - if ((localeRet=TA_TEXTDOMAIN("furnace"))==NULL) { - logE("could not text domain!"); - } else { - logV("text domain 2: %s",localeRet); - } - } #endif + } initParams();