summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-08-28 12:54:35 +0200
committerEike Rathke <erack@redhat.com>2013-08-28 15:06:42 +0200
commitca76d5f034ab3f78a359d443ba72fce849b2b795 (patch)
tree5936a3aea38bba7de133a1f404767955434a186e
parenta4772f2ba4b003d97f67077a9503ebe584f2897e (diff)
added Bcp47CountryEntry
Change-Id: I6ba7c0bdc8f72910a414a07432815bc225125a07
-rw-r--r--i18nlangtag/source/isolang/isolang.cxx30
1 files changed, 30 insertions, 0 deletions
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 5e870759d83b..688e3c044ef0 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -61,6 +61,19 @@ struct IsoLanguageScriptCountryEntry
bool startsInIgnoreAsciiCase( const OUString & rStr ) const;
};
+struct Bcp47CountryEntry
+{
+ LanguageType mnLang;
+ const sal_Char* mpBcp47;
+ sal_Char maCountry[3];
+
+ /** Obtain a language tag string with '-' separator. */
+ OUString getTagString() const;
+
+ /** Obtain a locale. */
+ ::com::sun::star::lang::Locale getLocale() const;
+};
+
struct IsoLangEngEntry
{
LanguageType mnLang;
@@ -565,6 +578,13 @@ static IsoLanguageScriptCountryEntry const aImplIsoLangScriptEntries[] =
{ LANGUAGE_DONTKNOW, "", "" } // marks end of table
};
+static Bcp47CountryEntry const aImplBcp47CountryEntries[] =
+{
+ // MS-LangID full BCP47, ISO3166
+// { LANGUAGE_USER_CATALAN_VALENCIAN, "ca-valencia-ES", "ES" }, // for example, once we support it in l10n; TODO: add to unit test
+ { LANGUAGE_DONTKNOW, "", "" } // marks end of table
+};
+
static IsoLanguageCountryEntry aLastResortFallbackEntry =
{ LANGUAGE_ENGLISH_US, "en", "US" };
@@ -599,6 +619,16 @@ bool IsoLanguageScriptCountryEntry::startsInIgnoreAsciiCase( const OUString & rS
return rStr.matchIgnoreAsciiCaseAsciiL( maLanguageScript, strlen( maLanguageScript), 0);
}
+OUString Bcp47CountryEntry::getTagString() const
+{
+ return OUString::createFromAscii( mpBcp47);
+}
+
+::com::sun::star::lang::Locale Bcp47CountryEntry::getLocale() const
+{
+ return lang::Locale( I18NLANGTAG_QLT, OUString::createFromAscii( maCountry), getTagString());
+}
+
// -----------------------------------------------------------------------
// In this table are the countries which should mapped to a specific