summaryrefslogtreecommitdiff
path: root/i18npool/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-04-04 21:27:53 +0200
committerEike Rathke <erack@redhat.com>2013-04-05 14:52:45 +0200
commitbabbd149aa9b2b5a28c55cb38fbbe24586bf8e22 (patch)
treeaf9ad4be57671256120d5af4ef63468e40e458db /i18npool/source
parent9d073bcba10b9cbcd56ad58cf5b19bbb129567a8 (diff)
added the dreaded jolly joker
Change-Id: I1bd840391496daab2cfe32af6ac00e98de3ed72e
Diffstat (limited to 'i18npool/source')
-rw-r--r--i18npool/source/isolang/isolang.cxx1
-rw-r--r--i18npool/source/isolang/mslangid.cxx9
-rw-r--r--i18npool/source/languagetag/languagetag.cxx9
3 files changed, 13 insertions, 6 deletions
diff --git a/i18npool/source/isolang/isolang.cxx b/i18npool/source/isolang/isolang.cxx
index e41d22892967..17a803343877 100644
--- a/i18npool/source/isolang/isolang.cxx
+++ b/i18npool/source/isolang/isolang.cxx
@@ -643,6 +643,7 @@ static IsoLangOtherEntry const aImplPrivateUseEntries[] =
{ LANGUAGE_USER_PRIV_NOTRANSLATE, "x-no-translate" }, //! not BCP47 but legacy in .xcu configmgr
{ LANGUAGE_USER_PRIV_DEFAULT, "x-default" },
{ LANGUAGE_USER_PRIV_COMMENT, "x-comment" },
+ { LANGUAGE_USER_PRIV_JOKER, "*" }, //! not BCP47 but transferable in configmgr
{ LANGUAGE_DONTKNOW, NULL } // marks end of table
};
diff --git a/i18npool/source/isolang/mslangid.cxx b/i18npool/source/isolang/mslangid.cxx
index 6afde6252c34..12cf5a3ad1da 100644
--- a/i18npool/source/isolang/mslangid.cxx
+++ b/i18npool/source/isolang/mslangid.cxx
@@ -149,8 +149,8 @@ void MsLangId::Conversion::convertLanguageToLocale( LanguageType nLang,
rLocale.Variant = OUString();
convertLanguageToIsoNames( nLang, rLocale.Language, rLocale.Country);
/* FIXME: this x-... is temporary until conversion will be moved up to
- * LanguageTag */
- if (rLocale.Language.startsWith( "x-"))
+ * LanguageTag. Also handle the nasty "*" joker as privateuse. */
+ if (rLocale.Language.startsWith( "x-") || (rLocale.Language == "*"))
{
rLocale.Variant = rLocale.Language;
rLocale.Language = "qlt";
@@ -186,8 +186,9 @@ LanguageType MsLangId::Conversion::convertLocaleToLanguage(
return LANGUAGE_SYSTEM;
/* FIXME: this x-... is temporary until conversion will be moved up to
- * LanguageTag */
- LanguageType nRet = ((!rLocale.Variant.isEmpty() && rLocale.Variant.startsWithIgnoreAsciiCase( "x-")) ?
+ * 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));
if (nRet == LANGUAGE_DONTKNOW)
diff --git a/i18npool/source/languagetag/languagetag.cxx b/i18npool/source/languagetag/languagetag.cxx
index 16b81d8427dc..c93943d52362 100644
--- a/i18npool/source/languagetag/languagetag.cxx
+++ b/i18npool/source/languagetag/languagetag.cxx
@@ -430,7 +430,7 @@ bool LanguageTag::canonicalize()
// locale.
OUString aLanguage, aScript, aCountry;
Extraction eExt = simpleExtract( maBcp47, aLanguage, aScript, aCountry);
- if (eExt == EXTRACTED_LSC || eExt == EXTRACTED_X)
+ if (eExt != EXTRACTED_NONE)
{
if (eExt == EXTRACTED_LSC && aScript.isEmpty())
{
@@ -1160,7 +1160,12 @@ LanguageTag::Extraction LanguageTag::simpleExtract( const OUString& rBcp47,
Extraction eRet = EXTRACTED_NONE;
const sal_Int32 nLen = rBcp47.getLength();
const sal_Int32 nHyph1 = rBcp47.indexOf( '-');
- if (nHyph1 == 1 && rBcp47[0] == 'x') // x-... privateuse
+ if (nLen == 1 && rBcp47[0] == '*') // * the dreaded jolly joker
+ {
+ // It's f*d up but we need to recognize this.
+ eRet = EXTRACTED_X_JOKER;
+ }
+ else if (nHyph1 == 1 && rBcp47[0] == 'x') // x-... privateuse
{
// x-... privateuse tags MUST be known to us by definition.
eRet = EXTRACTED_X;