diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-04-06 23:16:34 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-04-06 23:16:34 +0300 |
commit | 2c08dd3a145da904c6ceb5993435277a401b0408 (patch) | |
tree | 30987c26b89c331c08a18d313afd53e4148c47c5 /src/utils | |
parent | cefcd0ba62d96a16419fd428a4943621f39548c3 (diff) | |
download | ManaVerse-2c08dd3a145da904c6ceb5993435277a401b0408.tar.gz ManaVerse-2c08dd3a145da904c6ceb5993435277a401b0408.tar.bz2 ManaVerse-2c08dd3a145da904c6ceb5993435277a401b0408.tar.xz ManaVerse-2c08dd3a145da904c6ceb5993435277a401b0408.zip |
Add support for help pages translations.
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/stringutils.cpp | 14 | ||||
-rw-r--r-- | src/utils/stringutils.h | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index 02bba8599..a7e1b6c7d 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -439,3 +439,17 @@ std::string combineDye2(std::string file, std::string dye) return file; } } + +std::string getLang() +{ + char *lng = getenv("LANG"); + if (!lng) + return ""; + + std::string lang(lng); + int dot = lang.find("."); + if (dot == std::string::npos && dot > 0) + return lang; + + return lang.substr(0, dot); +}
\ No newline at end of file diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h index 02c25eddb..83773bd72 100644 --- a/src/utils/stringutils.h +++ b/src/utils/stringutils.h @@ -177,4 +177,6 @@ std::string combineDye(std::string file, std::string dye); std::string combineDye2(std::string file, std::string dye); +std::string getLang(); + #endif // UTILS_STRINGUTILS_H |