[Libreoffice-commits] core.git: 3 commits - i18nlangtag/source
Eike Rathke
erack at redhat.com
Wed Aug 28 03:28:20 PDT 2013
i18nlangtag/source/isolang/isolang.cxx | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
New commits:
commit 1e37bd43a9c9da1de72187a932cd8da60936cc95
Author: Eike Rathke <erack at redhat.com>
Date: Wed Aug 28 12:27:14 2013 +0200
field comments
Change-Id: I1df968ff81376b789c34f2c5e56acb6ac0ce30ed
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 8d3e6d2..5e87075 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -560,6 +560,7 @@ static IsoLanguageCountryEntry const aImplIsoLangEntries[] =
static IsoLanguageScriptCountryEntry const aImplIsoLangScriptEntries[] =
{
+ // MS-LangID ISO639-ISO15924, ISO3166
// { LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sr-Latn", "RS" }, // for example, once we support it in l10n; TODO: adapt unit test in this case
{ LANGUAGE_DONTKNOW, "", "" } // marks end of table
};
commit a40afb3f534ea1c655ac728e55a7e4b96b033869
Author: Eike Rathke <erack at redhat.com>
Date: Wed Aug 28 12:19:16 2013 +0200
added IsoLanguageScriptCountryEntry to getDefinedLanguagetags()
Change-Id: Icc7cecfca05ceb2b1b75422dd97a6d467b3697f4
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 8d07617..8d3e6d2 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -560,7 +560,7 @@ static IsoLanguageCountryEntry const aImplIsoLangEntries[] =
static IsoLanguageScriptCountryEntry const aImplIsoLangScriptEntries[] =
{
-// { LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sr-Latn", "RS" }, // for example, once we support it in l10n
+// { LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sr-Latn", "RS" }, // for example, once we support it in l10n; TODO: adapt unit test in this case
{ LANGUAGE_DONTKNOW, "", "" } // marks end of table
};
@@ -1116,7 +1116,13 @@ LanguageType MsLangId::convertUnxByteStringToLanguage(
::std::vector< MsLangId::LanguagetagMapping > MsLangId::getDefinedLanguagetags()
{
::std::vector< LanguagetagMapping > aVec;
- for (const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries; pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
+ for (const IsoLanguageScriptCountryEntry* pEntry = aImplIsoLangScriptEntries;
+ pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
+ {
+ aVec.push_back( LanguagetagMapping( pEntry->getTagString(), pEntry->mnLang));
+ }
+ for (const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
+ pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
{
aVec.push_back( LanguagetagMapping( pEntry->getTagString(), pEntry->mnLang));
}
commit 55503ad64689928e6c0c28a34e72a4dd3a3fa438
Author: Eike Rathke <erack at redhat.com>
Date: Wed Aug 28 12:14:32 2013 +0200
don't use startsWithIgnoreAsciiCase() on pointers
Change-Id: I407e4769be254446ad191ce7640ea1789bca1f1e
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 41d8411..8d07617 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -53,6 +53,12 @@ struct IsoLanguageScriptCountryEntry
/** Obtain a locale. */
::com::sun::star::lang::Locale getLocale() const;
+
+ /** If rStr starts with maLanguageScript ignoring case.
+
+ We don't have OUString::startsWithIgnoreAsciiCaseAscii()
+ */
+ bool startsInIgnoreAsciiCase( const OUString & rStr ) const;
};
struct IsoLangEngEntry
@@ -587,6 +593,11 @@ OUString IsoLanguageScriptCountryEntry::getTagString() const
return lang::Locale( I18NLANGTAG_QLT, OUString::createFromAscii( maCountry), getTagString());
}
+bool IsoLanguageScriptCountryEntry::startsInIgnoreAsciiCase( const OUString & rStr ) const
+{
+ return rStr.matchIgnoreAsciiCaseAsciiL( maLanguageScript, strlen( maLanguageScript), 0);
+}
+
// -----------------------------------------------------------------------
// In this table are the countries which should mapped to a specific
@@ -773,7 +784,7 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
for (const IsoLanguageScriptCountryEntry* pScriptEntry = aImplIsoLangScriptEntries;
pScriptEntry->mnLang != LANGUAGE_DONTKNOW; ++pScriptEntry)
{
- if (rLocale.Variant.startsWithIgnoreAsciiCase( pScriptEntry->maLanguageScript))
+ if (pScriptEntry->startsInIgnoreAsciiCase( rLocale.Variant))
{
if (rLocale.Variant.equalsIgnoreAsciiCase( pScriptEntry->getTagString()))
return pScriptEntry->getLocale();
@@ -792,7 +803,7 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
for (const IsoLanguageScriptCountryEntry* pScriptEntry = pFirstScript;
pScriptEntry->mnLang != LANGUAGE_DONTKNOW; ++pScriptEntry)
{
- if (rLocale.Variant.startsWithIgnoreAsciiCase( pScriptEntry->maLanguageScript) &&
+ if (pScriptEntry->startsInIgnoreAsciiCase( rLocale.Variant) &&
rLocale.Country.equalsIgnoreAsciiCaseAscii( pScriptEntry->maCountry))
return pScriptEntry->getLocale();
}
@@ -888,7 +899,7 @@ LanguageType MsLangId::Conversion::convertLocaleToLanguageImpl(
for (const IsoLanguageScriptCountryEntry* pScriptEntry = aImplIsoLangScriptEntries;
pScriptEntry->mnLang != LANGUAGE_DONTKNOW; ++pScriptEntry)
{
- if (rLocale.Variant.startsWithIgnoreAsciiCase( pScriptEntry->maLanguageScript))
+ if (pScriptEntry->startsInIgnoreAsciiCase( rLocale.Variant))
{
if (rLocale.Variant.equalsIgnoreAsciiCase( pScriptEntry->getTagString()))
return pScriptEntry->mnLang;
More information about the Libreoffice-commits
mailing list