[Libreoffice-commits] core.git: 2 commits - i18nlangtag/source
Eike Rathke
erack at redhat.com
Thu Aug 29 11:54:46 PDT 2013
i18nlangtag/source/isolang/isolang.cxx | 20 +++++++++++---------
i18nlangtag/source/isolang/mslangid.cxx | 8 ++++++++
2 files changed, 19 insertions(+), 9 deletions(-)
New commits:
commit e57a73cc6bedcb8f176e1804792a7ea1fd88796b
Author: Eike Rathke <erack at redhat.com>
Date: Thu Aug 29 20:51:45 2013 +0200
convertLanguageToLocale: last resort en-US if resolve requested
Change-Id: I8ebdfe34765292f14642ec8c2721621e5638a17a
diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx
index 6e816ee..8f398e5 100644
--- a/i18nlangtag/source/isolang/mslangid.cxx
+++ b/i18nlangtag/source/isolang/mslangid.cxx
@@ -153,9 +153,17 @@ LanguageType MsLangId::resolveSystemLanguageByScriptType( LanguageType nLang, sa
{
// Still resolve LANGUAGE_DONTKNOW if resolving is not requested,
// but not LANGUAGE_SYSTEM or others.
+ LanguageType nOrigLang = nLang;
if (bResolveSystem || nLang == LANGUAGE_DONTKNOW)
nLang = MsLangId::getRealLanguage( nLang);
convertLanguageToLocaleImpl( nLang, aLocale);
+ if (bResolveSystem && aLocale.Language.isEmpty() && simplifySystemLanguages( nOrigLang) == LANGUAGE_SYSTEM)
+ {
+ // None found but resolve requested, last resort is "en-US".
+ aLocale.Language = "en";
+ aLocale.Country = "US";
+ aLocale.Variant = OUString();
+ }
}
return aLocale;
}
commit 83d6ce0b1eb6229a518d79a1064a75956a0380f1
Author: Eike Rathke <erack at redhat.com>
Date: Thu Aug 29 20:09:47 2013 +0200
adapted comments
Change-Id: I830947d867d77b8e58b6e4722ceb3b7993292dad
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index b2c9da5..d3ababc 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -96,10 +96,12 @@ struct IsoLangOtherEntry
// -----------------------------------------------------------------------
// Entries for languages are lower case, for countries upper case, as
-// recommended by rfc4646 (obsoletes rfc3066 (obsoletes rfc1766)).
-// convertIsoNamesToLanguage() is case insensitive
+// recommended by rfc5646 (obsoletes rfc4646 (obsoletes rfc3066 (obsoletes
+// rfc1766))). convertIsoNamesToLanguage(), convertLocaleToLanguageImpl()
+// and lookupFallbackLocale() are case insensitive.
//
-// Sort order: Most used first.
+// Sort order: Most used first and within one language the default fallback
+// locale of that language first.
//
// The default entry for a LangID <-> ISO mapping has to be first. For
// conversion of legacy mappings one LangID can map to multiple ISO codes, and
@@ -115,18 +117,18 @@ struct IsoLangOtherEntry
// entry matching the language and not having a country is returned, regardless
// of whether being sorted before or after other entries of the same language
// with some country. To obtain a _locale_ (not language only) in the order
-// given, convertLocaleToLanguageWithFallback() must be called.
+// given, lookupFallbackLocale() must be called.
// If the sequence instead was
// LANGUAGE_ENGLISH_US, "en", "US"
// LANGUAGE_ENGLISH, "en", ""
-// in a convertIsoNamesToLanguage() call "en-US" is still converted to
-// LANGUAGE_ENGLISH_US, but "en" is _also_ converted to LANGUAGE_ENGLISH_US
-// because no country was passed and it is the first entry to match the
-// language, see code. A call with "en-ZZ" (not in table) would still result in
-// LANGUAGE_ENGLISH.
+// in a convertIsoNamesToLanguage() call "en-US" would still be converted to
+// LANGUAGE_ENGLISH_US, but "en" would _also_ be converted to
+// LANGUAGE_ENGLISH_US because no country was passed and it is the first entry
+// to match the language, see code. A call with "en-ZZ" (not in table) would
+// still result in LANGUAGE_ENGLISH.
/* erAck: 2007-07-05T20:01+0200 TODO: The entire suite's "primary language
* only" usage and locale fall back should be cleaned up and made consistent. I
More information about the Libreoffice-commits
mailing list