diff options
author | Eike Rathke <erack@redhat.com> | 2014-11-11 18:46:54 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2014-11-11 18:58:10 +0100 |
commit | 0d3ca29fd21bbd39531c2dd72fca05eeee2f166a (patch) | |
tree | 49ea3dacc570244da5e7a749c8d50115d6934b64 | |
parent | 5d51b13048d5f1ede7e5fa446dfd965e33d723a9 (diff) |
for unknown locales check is needed even for ll[l][-CC] tag, fdo#86011 related
Found when investigating fdo#86011 where 'du-nl' was accepted and
assigned an on-the-fly-ID even if the 'du' language code is not defined
in ISO 639. If a tag is not internally known we need to check it using
liblangtag and take no short cut assuming it would be alright even not
for the simplest case.
Change-Id: Ib8c1eb77b6b4a59019c4c8248b596bf53c0f4986
-rw-r--r-- | i18nlangtag/source/languagetag/languagetag.cxx | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 37e1893c52cd..74a31b84e399 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -1148,24 +1148,19 @@ bool LanguageTagImpl::canonicalize() } if (mbInitializedLocale) { - if (maLocale.Variant.isEmpty()) - meIsLiblangtagNeeded = DECISION_NO; // per definition ll[l][-CC] + if (!mbInitializedLangID) + { + convertLocaleToLang( false); + if (bTemporaryLocale || mnLangID == LANGUAGE_DONTKNOW) + bTemporaryLangID = true; + } + if (mnLangID != LANGUAGE_DONTKNOW && mnLangID != LANGUAGE_SYSTEM) + meIsLiblangtagNeeded = DECISION_NO; // known locale else { - if (!mbInitializedLangID) - { - convertLocaleToLang( false); - if (bTemporaryLocale || mnLangID == LANGUAGE_DONTKNOW) - bTemporaryLangID = true; - } - if (mnLangID != LANGUAGE_DONTKNOW && mnLangID != LANGUAGE_SYSTEM) - meIsLiblangtagNeeded = DECISION_NO; // known locale - else - { - const KnownTagSet& rKnowns = getKnowns(); - if (rKnowns.find( maBcp47) != rKnowns.end()) - meIsLiblangtagNeeded = DECISION_NO; // known fallback - } + const KnownTagSet& rKnowns = getKnowns(); + if (rKnowns.find( maBcp47) != rKnowns.end()) + meIsLiblangtagNeeded = DECISION_NO; // known fallback } // We may have an internal override "canonicalization". lang::Locale aNew( MsLangId::Conversion::getOverride( maLocale)); |