diff options
author | Riccardo Spagni <ric@spagni.net> | 2015-11-21 13:08:39 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2015-11-21 13:08:42 +0200 |
commit | 9276233b9ea58a19a5c1490b70cbec90ebcc3147 (patch) | |
tree | 8eb1cef8eadd62c4bebb4ee026eba0ab0f58fd49 /src/common/i18n.cpp | |
parent | Merge pull request #492 (diff) | |
parent | Fix startup crash when using a locale boost does not like (diff) | |
download | monero-9276233b9ea58a19a5c1490b70cbec90ebcc3147.tar.xz |
Merge pull request #493
f3724ae Fix startup crash when using a locale boost does not like (moneromooo-monero)
0c1dae3 i18n: allow language to be passed as a parameter (moneromooo-monero)
Diffstat (limited to 'src/common/i18n.cpp')
-rw-r--r-- | src/common/i18n.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/common/i18n.cpp b/src/common/i18n.cpp index 9add06cb9..06b4423a7 100644 --- a/src/common/i18n.cpp +++ b/src/common/i18n.cpp @@ -45,7 +45,7 @@ static std::map<std::string,std::string> i18n_entries; // #define i18n_log(x) do { std::cout << __FILE__ << ":" << __LINE__ << ": " << x << std::endl; std::cout << std::flush; } while(0) #define i18n_log(x) ((void)0) -static std::string get_language() +std::string i18n_get_language() { const char *e; @@ -111,9 +111,9 @@ static std::string utf8(const unsigned char *data, uint32_t len) return std::string((const char *)data,len); } -int i18n_set_language(const char *directory, const char *base) +int i18n_set_language(const char *directory, const char *base, std::string language) { - std::string language, filename, contents; + std::string filename, contents; const unsigned char *data; size_t datalen; size_t idx; @@ -128,7 +128,8 @@ int i18n_set_language(const char *directory, const char *base) if (!directory || !base) return -1; - language = get_language(); + if (language.empty()) + language = i18n_get_language(); filename = std::string(directory) + "/" + base + "_" + language + ".qm"; i18n_log("Loading translations for language " << language); |