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
This commit is contained in:
Eike Rathke
2014-11-11 18:46:54 +01:00
parent 5d51b13048
commit 0d3ca29fd2

View File

@@ -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));