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.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index 8ae155bf7..ea2d18276 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -440,16 +440,20 @@ std::string combineDye2(std::string file, std::string dye)
}
}
-std::string getLang()
+std::vector<std::string> getLang()
{
+ std::vector<std::string> langs;
char *lng = getenv("LANG");
if (!lng)
- return "";
+ return langs;
std::string lang(lng);
int dot = lang.find(".");
- if (dot == (signed)std::string::npos)
- return lang;
-
- return lang.substr(0, dot);
+ if (dot != (signed)std::string::npos)
+ lang = lang.substr(0, dot);
+ langs.push_back(lang);
+ dot = lang.find("_");
+ if (dot != (signed)std::string::npos)
+ langs.push_back(lang.substr(0, dot));
+ return langs;
} \ No newline at end of file