[Libreoffice-commits] core.git: 3 commits - i18nlangtag/qa i18nlangtag/source
Eike Rathke
erack at redhat.com
Wed Aug 28 06:07:06 PDT 2013
i18nlangtag/qa/cppunit/test_languagetag.cxx | 23 +++++++++++++++++++++
i18nlangtag/source/isolang/isolang.cxx | 30 ++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
New commits:
commit 4bfc4a51fe0c88472de6580edf7002031855eae3
Author: Eike Rathke <erack at redhat.com>
Date: Wed Aug 28 15:05:03 2013 +0200
added unit test for ca-ES-valencia
Change-Id: Ib4eb93f9ba8145f6404bed9393580646358bb805
diff --git a/i18nlangtag/qa/cppunit/test_languagetag.cxx b/i18nlangtag/qa/cppunit/test_languagetag.cxx
index 838f69b..08292b1 100644
--- a/i18nlangtag/qa/cppunit/test_languagetag.cxx
+++ b/i18nlangtag/qa/cppunit/test_languagetag.cxx
@@ -145,6 +145,29 @@ void TestLanguageTag::testAllTags()
}
{
+ OUString s_ca_valencia_ES( "ca-ES-valencia" );
+ LanguageTag ca_valencia_ES( s_ca_valencia_ES, true );
+ lang::Locale aLocale = ca_valencia_ES.getLocale();
+ CPPUNIT_ASSERT( ca_valencia_ES.getBcp47() == s_ca_valencia_ES );
+ CPPUNIT_ASSERT( aLocale.Language == "qlt" );
+ CPPUNIT_ASSERT( aLocale.Country == "ES" );
+ CPPUNIT_ASSERT( aLocale.Variant == s_ca_valencia_ES );
+ /* TODO: conversion doesn't know this yet, once it does activate test. */
+#if 0
+ CPPUNIT_ASSERT( ca_valencia_ES.getLanguageType() == LANGUAGE_USER_CATALAN_VALENCIAN );
+#else
+ CPPUNIT_ASSERT( ca_valencia_ES.getLanguageType() == LANGUAGE_SYSTEM );
+#endif
+ CPPUNIT_ASSERT( ca_valencia_ES.isValidBcp47() == true );
+ CPPUNIT_ASSERT( ca_valencia_ES.isIsoLocale() == false );
+ CPPUNIT_ASSERT( ca_valencia_ES.isIsoODF() == false );
+ CPPUNIT_ASSERT( ca_valencia_ES.getLanguage() == "ca" );
+ CPPUNIT_ASSERT( ca_valencia_ES.getCountry() == "ES" );
+ CPPUNIT_ASSERT( ca_valencia_ES.getScript() == "" );
+ CPPUNIT_ASSERT( ca_valencia_ES.getLanguageAndScript() == "ca" );
+ }
+
+ {
OUString s_de_DE( "de-DE" );
LanguageTag de_DE( s_de_DE, true );
lang::Locale aLocale = de_DE.getLocale();
commit 980c0603edcc297f82a3926b87a535a0f0de9ce2
Author: Eike Rathke <erack at redhat.com>
Date: Wed Aug 28 15:00:48 2013 +0200
correct example is ca-ES-valencia
Change-Id: I04cc9a1bb5a3dd92dc2cb8ce49609acf9daaf139
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 688e3c0..b2c9da5 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -581,7 +581,7 @@ static IsoLanguageScriptCountryEntry const aImplIsoLangScriptEntries[] =
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_USER_CATALAN_VALENCIAN, "ca-ES-valencia", "ES" }, // for example, once we support it in l10n; TODO: add to unit test
{ LANGUAGE_DONTKNOW, "", "" } // marks end of table
};
commit ca76d5f034ab3f78a359d443ba72fce849b2b795
Author: Eike Rathke <erack at redhat.com>
Date: Wed Aug 28 12:54:35 2013 +0200
added Bcp47CountryEntry
Change-Id: I6ba7c0bdc8f72910a414a07432815bc225125a07
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 5e87075..688e3c0 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
More information about the Libreoffice-commits
mailing list