summaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-18 03:10:10 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-18 03:10:10 +0300
commit74d12df575b7d2cf7e95407df80dbb699ca9806e (patch)
treea03aae01ae6e458b4fd1feecc99265d17da57627 /src/utils
parent4a83474614ed67349b83c742b8498937b2e190e7 (diff)
downloadmv-74d12df575b7d2cf7e95407df80dbb699ca9806e.tar.gz
mv-74d12df575b7d2cf7e95407df80dbb699ca9806e.tar.bz2
mv-74d12df575b7d2cf7e95407df80dbb699ca9806e.tar.xz
mv-74d12df575b7d2cf7e95407df80dbb699ca9806e.zip
Allow try different language part for searching help translations.
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/stringutils.cpp16
-rw-r--r--src/utils/stringutils.h3
2 files changed, 12 insertions, 7 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
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 83773bd72..f0dbf0bd9 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -27,6 +27,7 @@
#include <sstream>
#include <list>
#include <set>
+#include <vector>
/**
* Trims spaces off the end and the beginning of the given string.
@@ -177,6 +178,6 @@ std::string combineDye(std::string file, std::string dye);
std::string combineDye2(std::string file, std::string dye);
-std::string getLang();
+std::vector<std::string> getLang();
#endif // UTILS_STRINGUTILS_H