diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-11-05 16:34:36 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-11-05 16:49:22 +0300 |
commit | d6c2460155fd7ab51481f36930a3d73c032bba29 (patch) | |
tree | 2861a4337891aa0dfc0cc27dd7ad284f05a18788 /src/utils/stringutils.cpp | |
parent | 59de32ee947fd8d7adb230f57f0528d8d292771a (diff) | |
download | plus-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/utils/stringutils.cpp')
-rw-r--r-- | src/utils/stringutils.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
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); |