summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-11-05 16:34:36 +0300
committerAndrei Karas <akaras@inbox.ru>2011-11-05 16:49:22 +0300
commitd6c2460155fd7ab51481f36930a3d73c032bba29 (patch)
tree2861a4337891aa0dfc0cc27dd7ad284f05a18788 /src
parent59de32ee947fd8d7adb230f57f0528d8d292771a (diff)
downloadplus-d6c2460155fd7ab51481f36930a3d73c032bba29.tar.gz
plus-d6c2460155fd7ab51481f36930a3d73c032bba29.tar.bz2
plus-d6c2460155fd7ab51481f36930a3d73c032bba29.tar.xz
plus-d6c2460155fd7ab51481f36930a3d73c032bba29.zip
Fix current language detection if using custom language.
Diffstat (limited to 'src')
-rw-r--r--src/client.cpp7
-rw-r--r--src/gui/setup_theme.cpp2
-rw-r--r--src/utils/stringutils.cpp15
3 files changed, 19 insertions, 5 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 262c63d4a..642b967b1 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -167,6 +167,10 @@ int start_time;
int textures_count = 0;
+#ifdef WIN32
+extern "C" char const *_nl_locale_name_default(void);
+#endif
+
/**
* Advances game logic counter.
* Called every 10 milliseconds by SDL_AddTimer()
@@ -289,6 +293,9 @@ Client::Client(const Options &options):
#if ENABLE_NLS
std::string lang = config.getValue("lang", "");
#ifdef WIN32
+ if (lang == "")
+ lang = std::string(_nl_locale_name_default());
+
putenv((char*)("LANG=" + lang).c_str());
putenv((char*)("LANGUAGE=" + lang).c_str());
// mingw doesn't like LOCALEDIR to be defined for some reason
diff --git a/src/gui/setup_theme.cpp b/src/gui/setup_theme.cpp
index 56ce0188a..dbad66081 100644
--- a/src/gui/setup_theme.cpp
+++ b/src/gui/setup_theme.cpp
@@ -150,7 +150,7 @@ const Language LANG_NAME[langs_count] =
{N_("French"), "fr_FR"},
{N_("German"), "de_DE"},
{N_("Indonesian"), "id_ID"},
- {N_("Japanese"), "ja_JP"},
+ {N_("Japanese"), "ja_JP.utf8"},
{N_("Dutch (Belgium/Flemish)"), "nl_BE"},
{N_("Portuguese"), "pt_PT"},
{N_("Portuguese (Brazilian)"), "pt_BR"},
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 6c50d4019..39f14a646 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -22,6 +22,8 @@
#include "utils/stringutils.h"
+#include "configuration.h"
+
#include <string.h>
#include <algorithm>
#include <cstdarg>
@@ -487,11 +489,16 @@ std::string combineDye2(std::string file, std::string dye)
std::vector<std::string> getLang()
{
std::vector<std::string> langs;
- char *lng = getenv("LANG");
- if (!lng)
- return langs;
- std::string lang(lng);
+ std::string lang = config.getValue("lang", "").c_str();
+ if (lang.empty())
+ {
+ char *lng = getenv("LANG");
+ if (!lng)
+ return langs;
+ lang = lng;
+ }
+
int dot = lang.find(".");
if (dot != (signed)std::string::npos)
lang = lang.substr(0, dot);