diff options
author | Yuri Gorshenin <mipt.vi002@gmail.com> | 2017-04-21 19:41:39 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-21 19:41:39 +0300 |
commit | 2ae9a8d2d0a57782de5af9bd6502ded5fd60566f (patch) | |
tree | fb896c4534e0b22efdf819d5a28e2b697442915a /coding | |
parent | 8d69dd629c39c7c2a4f49ca4bfdabd2ddadadbb7 (diff) | |
parent | 1907335b06f4bfd5a8755701ffcd0600ad370a3f (diff) |
Merge pull request #5887 from darina/single-name-scheme
When the language of the user is equal to one of the languages of the…
Diffstat (limited to 'coding')
-rw-r--r-- | coding/multilang_utf8_string.cpp | 4 | ||||
-rw-r--r-- | coding/transliteration.cpp | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/coding/multilang_utf8_string.cpp b/coding/multilang_utf8_string.cpp index 0a2fce644b..333bfdcc5f 100644 --- a/coding/multilang_utf8_string.cpp +++ b/coding/multilang_utf8_string.cpp @@ -25,7 +25,7 @@ StringUtf8Multilang::Languages const g_languages = { {"be", "Беларуская", "Belarusian-Latin/BGN"}, {"ka", "ქართული", "Georgian-Latin"}, {"ko", "한국어", "Hangul-Latin/BGN"}, - {"he", "עברית", "Hebrew-Latin/BGN"}, + {"he", "עברית", "Hebrew-Latin"}, {"nl", "Nederlands", ""}, {"ga", "Gaeilge", ""}, {"ja_rm", "Japanese (Romanized)", "Any-Latin"}, @@ -33,7 +33,7 @@ StringUtf8Multilang::Languages const g_languages = { {"it", "Italiano", ""}, {"es", "Español", ""}, {"zh_pinyin", "Chinese (Pinyin)", "Any-Latin"}, - {"th", "ไทย", "Thai-Latin"}, + {"th", "ไทย", ""}, // Thai-Latin {"cy", "Cymraeg", ""}, {"sr", "Српски", "Serbian-Latin/BGN"}, {"uk", "Українська", "Ukrainian-Latin/BGN"}, diff --git a/coding/transliteration.cpp b/coding/transliteration.cpp index 618c602471..84cc8fca75 100644 --- a/coding/transliteration.cpp +++ b/coding/transliteration.cpp @@ -63,7 +63,7 @@ bool Transliteration::Transliterate(std::string const & str, int8_t langCode, st if (str.empty()) return false; - std::string const transliteratorId(StringUtf8Multilang::GetTransliteratorIdByCode(langCode)); + std::string transliteratorId(StringUtf8Multilang::GetTransliteratorIdByCode(langCode)); if (transliteratorId.empty()) return false; @@ -81,12 +81,16 @@ bool Transliteration::Transliterate(std::string const & str, int8_t langCode, st if (!it->second->m_initialized) { UErrorCode status = U_ZERO_ERROR; - UnicodeString translitId(it->first.c_str()); + + std::string const removeDiacriticRule = ";NFD;[\u02B9-\u02D3\u0301-\u0358]Remove;NFC"; + transliteratorId.append(removeDiacriticRule); + + UnicodeString translitId(transliteratorId.c_str()); it->second->m_transliterator.reset(Transliterator::createInstance(translitId, UTRANS_FORWARD, status)); if (it->second->m_transliterator == nullptr) - LOG(LWARNING, ("Cannot create transliterator \"", it->first, "\", icu error =", status)); + LOG(LWARNING, ("Cannot create transliterator \"", transliteratorId, "\", icu error =", status)); it->second->m_initialized = true; } |