summaryrefslogtreecommitdiff
path: root/src/utils/stringutils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/stringutils.cpp')
-rw-r--r--src/utils/stringutils.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index a5c0c471b..08bcac9e6 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -522,6 +522,26 @@ std::string getLangSimple()
return lang;
}
+std::string getLangShort()
+{
+ std::string lang = config.getValue("lang", "").c_str();
+ if (lang.empty())
+ {
+ char *lng = getenv("LANG");
+ if (!lng)
+ return "";
+ lang = lng;
+ }
+
+ int dot = lang.find(".");
+ if (dot != (signed)std::string::npos)
+ lang = lang.substr(0, dot);
+ dot = lang.find("_");
+ if (dot != (signed)std::string::npos)
+ return lang.substr(0, dot);
+ return lang;
+}
+
std::string packList(std::list<std::string> &list)
{
std::list<std::string>::const_iterator i = list.begin();