summaryrefslogtreecommitdiff
path: root/i18nlangtag/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-09-20 16:41:59 +0200
committerEike Rathke <erack@redhat.com>2013-09-20 18:31:06 +0200
commitc640f19ca3aa1d918bd8df454d5ec45fbc2fad05 (patch)
tree53d4afbc6185dfc789d69255cf166f1b79d92c5b /i18nlangtag/source
parent75cb1e8541f1fb377fd4504ef5fd6ffea6bee7a1 (diff)
now with on-the-fly LangID assignment
Change-Id: I0766705191176381beaf331de3d10dfc0086a9b4
Diffstat (limited to 'i18nlangtag/source')
-rw-r--r--i18nlangtag/source/isolang/mslangid.cxx6
-rw-r--r--i18nlangtag/source/languagetag/languagetag.cxx15
2 files changed, 14 insertions, 7 deletions
diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx
index 0b0253f943ad..f547c3486636 100644
--- a/i18nlangtag/source/isolang/mslangid.cxx
+++ b/i18nlangtag/source/isolang/mslangid.cxx
@@ -177,11 +177,7 @@ LanguageType MsLangId::Conversion::convertLocaleToLanguage(
if (rLocale.Language.isEmpty())
return LANGUAGE_SYSTEM;
- LanguageType nRet = convertLocaleToLanguageImpl( rLocale);
- if (nRet == LANGUAGE_DONTKNOW)
- nRet = LANGUAGE_SYSTEM;
-
- return nRet;
+ return convertLocaleToLanguageImpl( rLocale);
}
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index e960ea99d875..91de5fd90d06 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -740,7 +740,9 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
if (pImpl->synCanonicalize())
{
SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: canonicalized to '" << pImpl->maBcp47 << "'");
- rMap.insert( ::std::make_pair( pImpl->maBcp47, pImpl));
+ bool bInserted = rMap.insert( ::std::make_pair( pImpl->maBcp47, pImpl)).second;
+ SAL_INFO( "i18nlangtag", "LanguageTag::registerImpl: " << (bInserted ? "" : "not ") << "inserted '"
+ << pImpl->maBcp47 << "'");
}
// Try round-trip Bcp47->Locale->LangID->Locale->Bcp47.
if (!pImpl->mbInitializedLocale)
@@ -1122,7 +1124,16 @@ void LanguageTagImpl::convertLocaleToLang( bool bAllowOnTheFlyID )
else
{
mnLangID = MsLangId::Conversion::convertLocaleToLanguage( maLocale);
- (void)bAllowOnTheFlyID;
+ if (mnLangID == LANGUAGE_DONTKNOW && bAllowOnTheFlyID)
+ {
+ if (isValidBcp47())
+ registerOnTheFly();
+ else
+ {
+ SAL_WARN( "i18nlangtag", "LanguageTagImpl::convertLocaleToLang: with bAllowOnTheFlyID invalid '"
+ << maBcp47 << "'");
+ }
+ }
}
mbInitializedLangID = true;
}