diff options
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r-- | src/utils/stringutils.cpp | 14 |
1 files changed, 14 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 |