diff options
author | Vadim ProductEngine <vsavchuk@productengine.com> | 2012-01-20 15:39:21 +0200 |
---|---|---|
committer | Vadim ProductEngine <vsavchuk@productengine.com> | 2012-01-20 15:39:21 +0200 |
commit | ac924627e29d827992c21200708b870643ec35cf (patch) | |
tree | 3e4a8f20c060f02d3475735a4ae66125a4764256 /indra/newview | |
parent | 82e90a6af580890eb685fc6b684d79ca905e6279 (diff) |
EXP-1820 FIXED Fixed translation to Chinese with Microsoft Translator.
Use correct language code for Traditional Chinese.
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/lltranslate.cpp | 10 | ||||
-rwxr-xr-x | indra/newview/lltranslate.h | 1 |
2 files changed, 9 insertions, 2 deletions
diff --git a/indra/newview/lltranslate.cpp b/indra/newview/lltranslate.cpp index c1cc9c7bc4..f3d8de1904 100755 --- a/indra/newview/lltranslate.cpp +++ b/indra/newview/lltranslate.cpp @@ -162,10 +162,10 @@ void LLBingTranslationHandler::getTranslateURL( const std::string &text) const { url = std::string("http://api.microsofttranslator.com/v2/Http.svc/Translate?appId=") - + getAPIKey() + "&text=" + LLURI::escape(text) + "&to=" + to_lang; + + getAPIKey() + "&text=" + LLURI::escape(text) + "&to=" + getAPILanguageCode(to_lang); if (!from_lang.empty()) { - url += "&from=" + from_lang; + url += "&from=" + getAPILanguageCode(from_lang); } } @@ -236,6 +236,12 @@ std::string LLBingTranslationHandler::getAPIKey() return gSavedSettings.getString("BingTranslateAPIKey"); } +// static +std::string LLBingTranslationHandler::getAPILanguageCode(const std::string& lang) +{ + return lang == "zh" ? "zh-CHT" : lang; // treat Chinese as Traditional Chinese +} + LLTranslate::TranslationReceiver::TranslationReceiver(const std::string& from_lang, const std::string& to_lang) : mFromLang(from_lang) , mToLang(to_lang) diff --git a/indra/newview/lltranslate.h b/indra/newview/lltranslate.h index 424bc14587..c58e1adb8c 100755 --- a/indra/newview/lltranslate.h +++ b/indra/newview/lltranslate.h @@ -157,6 +157,7 @@ public: /*virtual*/ bool isConfigured() const; private: static std::string getAPIKey(); + static std::string getAPILanguageCode(const std::string& lang); }; /** |