diff options
author | Eike Rathke <erack@redhat.com> | 2013-08-27 17:54:28 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-08-27 18:09:11 +0200 |
commit | fbf0a3ee5fec87bff4fd5c373509b287d88a0a31 (patch) | |
tree | 6fce95d3e90169ae8152db8d673c7d3c2cfad2af /i18nlangtag | |
parent | a18c90dfe5f07227dea5c8e7cc21167ee90e446a (diff) |
in convertLocaleToLanguageImpl() don't use the implied fall back
... and through of dreaded convertIsoNamesToLanguage()
Change-Id: Ifb86974f9398094ed1a513a060ff61d63f798ea3
Diffstat (limited to 'i18nlangtag')
-rw-r--r-- | i18nlangtag/source/isolang/isolang.cxx | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx index 9722700c8d94..58ef58e77080 100644 --- a/i18nlangtag/source/isolang/isolang.cxx +++ b/i18nlangtag/source/isolang/isolang.cxx @@ -878,13 +878,39 @@ LanguageType MsLangId::Conversion::convertPrivateUseToLanguage( const OUString& LanguageType MsLangId::Conversion::convertLocaleToLanguageImpl( const ::com::sun::star::lang::Locale& rLocale ) { - /* FIXME: this x-... is temporary until conversion will be moved up to - * LanguageTag. Also handle the nasty "*" joker as privateuse. */ - LanguageType nRet = ((!rLocale.Variant.isEmpty() && - (rLocale.Variant.startsWithIgnoreAsciiCase( "x-") || (rLocale.Variant == "*"))) ? - convertPrivateUseToLanguage( rLocale.Variant) : - convertIsoNamesToLanguage( rLocale.Language, rLocale.Country)); - return nRet; + if (rLocale.Language == I18NLANGTAG_QLT) + { + // "x-..." private use and the nasty "*" joker + if (rLocale.Variant.startsWithIgnoreAsciiCase( "x-") || (rLocale.Variant == "*")) + return convertPrivateUseToLanguage( rLocale.Variant); + + // Search in ISO lll-Ssss-CC + for (const IsoLanguageScriptCountryEntry* pScriptEntry = aImplIsoLangScriptEntries; + pScriptEntry->mnLang != LANGUAGE_DONTKNOW; ++pScriptEntry) + { + if (rLocale.Variant.startsWith( pScriptEntry->maLanguageScript)) + { + if (pScriptEntry->getTagString() == rLocale.Variant) + return pScriptEntry->mnLang; + } + } + } + else + { + // language is lower case in table + OUString aLowerLang = rLocale.Language.toAsciiLowerCase(); + // country is upper case in table + OUString aUpperCountry = rLocale.Country.toAsciiUpperCase(); + + // Search in ISO lll-CC + for (const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries; + pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry) + { + if (aLowerLang.equalsAscii( pEntry->maLanguage) && aUpperCountry.equalsAscii( pEntry->maCountry)) + return pEntry->mnLang; + } + } + return LANGUAGE_DONTKNOW; } |