[Libreoffice-commits] core.git: 7 commits - i18nlangtag/source
Eike Rathke
erack at redhat.com
Tue Aug 27 07:28:42 PDT 2013
i18nlangtag/source/isolang/isolang.cxx | 247 ++++++++++++++++++++-------------
1 file changed, 155 insertions(+), 92 deletions(-)
New commits:
commit 78e2309c0fb21d77b64f37b3269d0d53e6fa7d1b
Author: Eike Rathke <erack at redhat.com>
Date: Tue Aug 27 16:24:02 2013 +0200
use IsoLanguageScriptCountryEntry in convertLanguageToLocaleImpl()
... and lookupFallbackLocale()
Change-Id: I736ee24801b825c916edba25e1b43bbcbc3f1506
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 6d66eb2..db13298 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -712,7 +712,18 @@ static IsoLangOtherEntry const aImplPrivateUseEntries[] =
void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
::com::sun::star::lang::Locale & rLocale )
{
- // Search for LangID (in this table we find only defined ISO combinations)
+ // Search for LangID in ISO lll-Ssss-CC
+ for (const IsoLanguageScriptCountryEntry* pScriptEntry = aImplIsoLangScriptEntries;
+ pScriptEntry->mnLang != LANGUAGE_DONTKNOW; ++pScriptEntry)
+ {
+ if ( pScriptEntry->mnLang == nLang )
+ {
+ rLocale = pScriptEntry->getLocale();
+ return;
+ }
+ }
+
+ // Search for LangID in ISO lll-CC
for (const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
{
@@ -753,6 +764,50 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
OUString aUpperCountry = rLocale.Country.toAsciiUpperCase();
sal_Int32 nCountryLen = aUpperCountry.getLength();
+ if (!rLocale.Variant.isEmpty())
+ {
+ // Search in ISO lll-Ssss-CC
+ const IsoLanguageScriptCountryEntry* pFirstScript = NULL;
+ for (const IsoLanguageScriptCountryEntry* pScriptEntry = aImplIsoLangScriptEntries;
+ pScriptEntry->mnLang != LANGUAGE_DONTKNOW; ++pScriptEntry)
+ {
+ if (rLocale.Variant.startsWith( pScriptEntry->maLanguageScript))
+ {
+ if (pScriptEntry->getTagString() == rLocale.Variant)
+ return pScriptEntry->getLocale();
+ if (!pFirstScript)
+ pFirstScript = pScriptEntry;
+ }
+ }
+ // If at least a lll-Ssss matched, try that with country or use it as
+ // fallback.
+ if (pFirstScript)
+ {
+ // Check for country only if there is more than lll-Ssss-CC in tag
+ // string, else we would had matched it already.
+ if (!rLocale.Country.isEmpty() && rLocale.Variant.getLength() > 11)
+ {
+ for (const IsoLanguageScriptCountryEntry* pScriptEntry = pFirstScript;
+ pScriptEntry->mnLang != LANGUAGE_DONTKNOW; ++pScriptEntry)
+ {
+ if (rLocale.Variant.startsWith( pScriptEntry->maLanguageScript) &&
+ pScriptEntry->maCountry == rLocale.Country)
+ return pScriptEntry->getLocale();
+ }
+ }
+ return pFirstScript->getLocale();
+ }
+ // Extract language from tag string, country is used as present in
+ // Locale because in the tables that follow we have only ISO 3166
+ // countries and if that is in the tag string we also have it in the
+ // Locale.
+ sal_Int32 nIndex = 0;
+ aLowerLang = rLocale.Variant.getToken( 0, '-', nIndex).toAsciiLowerCase();
+ // Cater for "x-..."
+ if (aLowerLang.getLength() == 1 && aLowerLang[0] == 'x' && nIndex > 0)
+ aLowerLang += "-" + rLocale.Variant.getToken( 0, '-', nIndex).toAsciiLowerCase();
+ }
+
// Search for locale and remember first lang-only.
const IsoLanguageCountryEntry* pFirstLang = NULL;
const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
commit 3b408e0e3623643f2ea605c28645fd2e51abaa6c
Author: Eike Rathke <erack at redhat.com>
Date: Tue Aug 27 14:50:00 2013 +0200
changed do{}while() to for(){}
Change-Id: I2c3962cdc3ad956333a37f73785928d5f1e94154
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 3a1a139..6d66eb2 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -713,8 +713,8 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
::com::sun::star::lang::Locale & rLocale )
{
// Search for LangID (in this table we find only defined ISO combinations)
- const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
- do
+ for (const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
+ pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
{
if ( pEntry->mnLang == nLang )
{
@@ -723,13 +723,11 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
rLocale.Variant = OUString();
return;
}
- ++pEntry;
}
- while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
// Look for privateuse definitions.
- const IsoLangOtherEntry* pPrivateEntry = aImplPrivateUseEntries;
- do
+ for (const IsoLangOtherEntry* pPrivateEntry = aImplPrivateUseEntries;
+ pPrivateEntry->mnLang != LANGUAGE_DONTKNOW; ++pPrivateEntry)
{
if ( pPrivateEntry->mnLang == nLang )
{
@@ -738,9 +736,7 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
rLocale.Variant = OUString::createFromAscii( pPrivateEntry->mpLanguage );
return;
}
- ++pPrivateEntry;
}
- while ( pPrivateEntry->mnLang != LANGUAGE_DONTKNOW );
// Not found. Passed rLocale argument remains unchanged.
}
@@ -760,7 +756,7 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
// Search for locale and remember first lang-only.
const IsoLanguageCountryEntry* pFirstLang = NULL;
const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
- do
+ for ( ; pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
{
if (aLowerLang.equalsAscii( pEntry->maLanguage))
{
@@ -786,9 +782,7 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
if (!pFirstLang)
pFirstLang = pEntry;
}
- ++pEntry;
}
- while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
// Language not found at all => use default.
if (!pFirstLang)
@@ -796,16 +790,14 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
// Search for first entry of language with any country.
pEntry = pFirstLang;
- do
+ for ( ; pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
{
if (aLowerLang.equalsAscii( pEntry->maLanguage))
{
if (*pEntry->maCountry)
return pEntry->getLocale();
}
- ++pEntry;
}
- while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
return aLastResortFallbackEntry.getLocale();
}
@@ -815,13 +807,12 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
// static
LanguageType MsLangId::Conversion::convertPrivateUseToLanguage( const OUString& rPriv )
{
- const IsoLangOtherEntry* pPrivateEntry = aImplPrivateUseEntries;
- do
+ for (const IsoLangOtherEntry* pPrivateEntry = aImplPrivateUseEntries;
+ pPrivateEntry->mnLang != LANGUAGE_DONTKNOW; ++pPrivateEntry)
{
if ( rPriv.equalsIgnoreAsciiCaseAscii( pPrivateEntry->mpLanguage ) )
return pPrivateEntry->mnLang;
- ++pPrivateEntry;
- } while ( pPrivateEntry->mnLang != LANGUAGE_DONTKNOW );
+ }
return LANGUAGE_DONTKNOW;
}
@@ -837,8 +828,8 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
// first look for exact match
const IsoLanguageCountryEntry* pFirstLang = NULL;
- const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
- do
+ for (const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
+ pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
{
if ( aLowerLang.equalsAscii( pEntry->maLanguage ) )
{
@@ -850,26 +841,22 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
else if ( !*pEntry->maCountry )
pFirstLang = pEntry;
}
- ++pEntry;
}
- while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
// some eng countries should be mapped to a specific english language
if ( aLowerLang == "en" )
{
- const IsoLangEngEntry* pEngEntry = aImplIsoLangEngEntries;
- do
+ for (const IsoLangEngEntry* pEngEntry = aImplIsoLangEngEntries;
+ pEngEntry->mnLang != LANGUAGE_DONTKNOW; ++pEngEntry)
{
if ( aUpperCountry.equalsAscii( pEngEntry->maCountry ) )
return pEngEntry->mnLang;
- ++pEngEntry;
}
- while ( pEngEntry->mnLang != LANGUAGE_DONTKNOW );
}
// test for specific languages which are not used standard ISO 3166 codes
- const IsoLangNoneStdEntry* pNoneStdEntry = aImplIsoNoneStdLangEntries;
- do
+ for (const IsoLangNoneStdEntry* pNoneStdEntry = aImplIsoNoneStdLangEntries;
+ pNoneStdEntry->mnLang != LANGUAGE_DONTKNOW; ++pNoneStdEntry)
{
if ( aLowerLang.equalsAscii( pNoneStdEntry->maLanguage ) )
{
@@ -877,23 +864,19 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
if ( aUpperCountry.equalsIgnoreAsciiCaseAscii( pNoneStdEntry->maCountry ) )
return pNoneStdEntry->mnLang;
}
- ++pNoneStdEntry;
}
- while ( pNoneStdEntry->mnLang != LANGUAGE_DONTKNOW );
- pNoneStdEntry = aImplIsoNoneStdLangEntries2;
- do
+ for (const IsoLangNoneStdEntry* pNoneStdEntry2 = aImplIsoNoneStdLangEntries2;
+ pNoneStdEntry2->mnLang != LANGUAGE_DONTKNOW; ++pNoneStdEntry2)
{
- if ( aLowerLang.equalsAscii( pNoneStdEntry->maLanguage ) )
+ if ( aLowerLang.equalsAscii( pNoneStdEntry2->maLanguage ) )
{
// The countries in this table are not all in upper case
- if ( aUpperCountry.equalsIgnoreAsciiCaseAscii( pNoneStdEntry->maCountry ) )
- return pNoneStdEntry->mnLang;
+ if ( aUpperCountry.equalsIgnoreAsciiCaseAscii( pNoneStdEntry2->maCountry ) )
+ return pNoneStdEntry2->mnLang;
}
- ++pNoneStdEntry;
}
- while ( pNoneStdEntry->mnLang != LANGUAGE_DONTKNOW );
- // If the language is correct, than we return the default language
+ // If the language is correct, then we return the default language
if ( pFirstLang )
return pFirstLang->mnLang;
@@ -901,14 +884,12 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
// (to allow reading country and language in separate steps, in any order)
if ( !rCountry.isEmpty() && rLang.isEmpty() )
{
- const IsoLanguageCountryEntry* pEntry2 = aImplIsoLangEntries;
- do
+ for (const IsoLanguageCountryEntry* pEntry2 = aImplIsoLangEntries;
+ pEntry2->mnLang != LANGUAGE_DONTKNOW; ++pEntry2)
{
if ( aUpperCountry.equalsAscii( pEntry2->maCountry ) )
return pEntry2->mnLang;
- ++pEntry2;
}
- while ( pEntry2->mnLang != LANGUAGE_DONTKNOW );
aLowerLang = aUpperCountry.toAsciiLowerCase();
}
@@ -919,14 +900,12 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
return nLang;
// Now look for all other definitions, which are not standard
- const IsoLangOtherEntry* pOtherEntry = aImplOtherEntries;
- do
+ for (const IsoLangOtherEntry* pOtherEntry = aImplOtherEntries;
+ pOtherEntry->mnLang != LANGUAGE_DONTKNOW; ++pOtherEntry)
{
if ( aLowerLang.equalsAscii( pOtherEntry->mpLanguage ) )
return pOtherEntry->mnLang;
- ++pOtherEntry;
}
- while ( pOtherEntry->mnLang != LANGUAGE_DONTKNOW );
return LANGUAGE_DONTKNOW;
}
@@ -1006,8 +985,8 @@ LanguageType MsLangId::convertUnxByteStringToLanguage(
OString aLowerLang = aLang.toAsciiLowerCase();
// country is upper case in table
OString aUpperCountry = aCountry.toAsciiUpperCase();
- const IsoLangGLIBCModifiersEntry* pGLIBCModifiersEntry = aImplIsoLangGLIBCModifiersEntries;
- do
+ for (const IsoLangGLIBCModifiersEntry* pGLIBCModifiersEntry = aImplIsoLangGLIBCModifiersEntries;
+ pGLIBCModifiersEntry->mnLang != LANGUAGE_DONTKNOW; ++pGLIBCModifiersEntry)
{ // avoid embedded \0 warning
if (aLowerLang.equals( static_cast< const char* >( pGLIBCModifiersEntry->maLanguage )) &&
aAtString.equals( static_cast< const char* >( pGLIBCModifiersEntry->maAtString )))
@@ -1018,9 +997,7 @@ LanguageType MsLangId::convertUnxByteStringToLanguage(
return pGLIBCModifiersEntry->mnLang;
}
}
- ++pGLIBCModifiersEntry;
}
- while ( pGLIBCModifiersEntry->mnLang != LANGUAGE_DONTKNOW );
}
return Conversion::convertIsoNamesToLanguage( aLang, aCountry );
commit 17382f9e5f005168f885c2f272a218f18316b7f8
Author: Eike Rathke <erack at redhat.com>
Date: Tue Aug 27 14:24:52 2013 +0200
added IsoLanguageScriptCountryEntry
Change-Id: Id3ce2ea6dff358546280107365e233607ad9f60c
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index e79d7e1..3a1a139 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -42,6 +42,19 @@ struct IsoLanguageCountryEntry
::com::sun::star::lang::Locale getLocale() const;
};
+struct IsoLanguageScriptCountryEntry
+{
+ LanguageType mnLang;
+ sal_Char maLanguageScript[9]; ///< "ll-Ssss" or "lll-Ssss"
+ 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;
@@ -539,6 +552,12 @@ static IsoLanguageCountryEntry const aImplIsoLangEntries[] =
{ LANGUAGE_DONTKNOW, "", "" } // marks end of table
};
+static IsoLanguageScriptCountryEntry const aImplIsoLangScriptEntries[] =
+{
+// { LANGUAGE_USER_SERBIAN_LATIN_SERBIA, "sr-Latn", "RS" }, // for example, once we support it in l10n
+ { LANGUAGE_DONTKNOW, "", "" } // marks end of table
+};
+
static IsoLanguageCountryEntry aLastResortFallbackEntry =
{ LANGUAGE_ENGLISH_US, "en", "US" };
@@ -555,6 +574,19 @@ OUString IsoLanguageCountryEntry::getTagString() const
return lang::Locale( OUString::createFromAscii( maLanguage), OUString::createFromAscii( maCountry), OUString());
}
+OUString IsoLanguageScriptCountryEntry::getTagString() const
+{
+ if (maCountry[0])
+ return OUString( OUString::createFromAscii( maLanguageScript) + "-" + OUString::createFromAscii( maCountry));
+ else
+ return OUString::createFromAscii( maLanguageScript);
+}
+
+::com::sun::star::lang::Locale IsoLanguageScriptCountryEntry::getLocale() const
+{
+ return lang::Locale( I18NLANGTAG_QLT, OUString::createFromAscii( maCountry), getTagString());
+}
+
// -----------------------------------------------------------------------
// In this table are the countries which should mapped to a specific
commit 7dd6699ae17b09d0999234d3c84190f502fda835
Author: Eike Rathke <erack at redhat.com>
Date: Tue Aug 27 14:12:58 2013 +0200
eliminate return of IsoLanguageCountryEntry &
Change-Id: I3cfe7781b6cdccc95f8164cf7557e29b34e5855c
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 8e6b9b5..e79d7e1 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -25,6 +25,8 @@
#include "i18nlangtag/mslangid.hxx"
#include "i18nlangtag/languagetag.hxx"
+using namespace com::sun::star;
+
// =======================================================================
struct IsoLanguageCountryEntry
@@ -35,6 +37,9 @@ struct IsoLanguageCountryEntry
/** Obtain a language tag string with '-' separator. */
OUString getTagString() const;
+
+ /** Obtain a locale. */
+ ::com::sun::star::lang::Locale getLocale() const;
};
struct IsoLangEngEntry
@@ -545,6 +550,11 @@ OUString IsoLanguageCountryEntry::getTagString() const
return OUString::createFromAscii( maLanguage);
}
+::com::sun::star::lang::Locale IsoLanguageCountryEntry::getLocale() const
+{
+ return lang::Locale( OUString::createFromAscii( maLanguage), OUString::createFromAscii( maCountry), OUString());
+}
+
// -----------------------------------------------------------------------
// In this table are the countries which should mapped to a specific
@@ -705,7 +715,8 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
// -----------------------------------------------------------------------
-static const IsoLanguageCountryEntry & lcl_lookupFallbackEntry(
+// static
+::com::sun::star::lang::Locale MsLangId::Conversion::lookupFallbackLocale(
const ::com::sun::star::lang::Locale & rLocale )
{
// language is lower case in table
@@ -724,7 +735,7 @@ static const IsoLanguageCountryEntry & lcl_lookupFallbackEntry(
if (*pEntry->maCountry)
{
if (nCountryLen && aUpperCountry.equalsAscii( pEntry->maCountry))
- return *pEntry;
+ return pEntry->getLocale();
}
else
{
@@ -735,7 +746,7 @@ static const IsoLanguageCountryEntry & lcl_lookupFallbackEntry(
case LANGUAGE_USER_ESPERANTO:
case LANGUAGE_USER_INTERLINGUA:
case LANGUAGE_USER_LOJBAN:
- return *pEntry;
+ return pEntry->getLocale();
default:
; // nothing
}
@@ -749,7 +760,7 @@ static const IsoLanguageCountryEntry & lcl_lookupFallbackEntry(
// Language not found at all => use default.
if (!pFirstLang)
- return aLastResortFallbackEntry;
+ return aLastResortFallbackEntry.getLocale();
// Search for first entry of language with any country.
pEntry = pFirstLang;
@@ -758,25 +769,13 @@ static const IsoLanguageCountryEntry & lcl_lookupFallbackEntry(
if (aLowerLang.equalsAscii( pEntry->maLanguage))
{
if (*pEntry->maCountry)
- return *pEntry;
+ return pEntry->getLocale();
}
++pEntry;
}
while ( pEntry->mnLang != LANGUAGE_DONTKNOW );
- return aLastResortFallbackEntry;
-}
-
-
-// static
-::com::sun::star::lang::Locale MsLangId::Conversion::lookupFallbackLocale(
- const ::com::sun::star::lang::Locale & rLocale )
-{
- const IsoLanguageCountryEntry& rEntry = lcl_lookupFallbackEntry( rLocale);
- return ::com::sun::star::lang::Locale(
- OUString::createFromAscii( rEntry.maLanguage),
- OUString::createFromAscii( rEntry.maCountry),
- OUString());
+ return aLastResortFallbackEntry.getLocale();
}
// =======================================================================
commit 334ccdb3d77ca9c1d26cd2cd21052277e1522334
Author: Eike Rathke <erack at redhat.com>
Date: Tue Aug 27 13:07:18 2013 +0200
IsoLangEntry to IsoLanguageCountryEntry
Change-Id: Ib8a185ab34d1024ba622d34a75d0b4b5c87eee76
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 05f25ab..8e6b9b5 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -27,7 +27,7 @@
// =======================================================================
-struct IsoLangEntry
+struct IsoLanguageCountryEntry
{
LanguageType mnLang;
sal_Char maLanguage[4];
@@ -99,7 +99,7 @@ struct IsoLangOtherEntry
* LANGUAGE_AZERI LANGUAGE_URDU LANGUAGE_KASHMIRI
*/
-static IsoLangEntry const aImplIsoLangEntries[] =
+static IsoLanguageCountryEntry const aImplIsoLangEntries[] =
{
// MS-LANGID codes ISO639-1/2/3 ISO3166
{ LANGUAGE_ENGLISH, "en", "" },
@@ -534,10 +534,10 @@ static IsoLangEntry const aImplIsoLangEntries[] =
{ LANGUAGE_DONTKNOW, "", "" } // marks end of table
};
-static IsoLangEntry aLastResortFallbackEntry =
+static IsoLanguageCountryEntry aLastResortFallbackEntry =
{ LANGUAGE_ENGLISH_US, "en", "US" };
-OUString IsoLangEntry::getTagString() const
+OUString IsoLanguageCountryEntry::getTagString() const
{
if (maCountry[0])
return OUString( OUString::createFromAscii( maLanguage) + "-" + OUString::createFromAscii( maCountry));
@@ -671,7 +671,7 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
::com::sun::star::lang::Locale & rLocale )
{
// Search for LangID (in this table we find only defined ISO combinations)
- const IsoLangEntry* pEntry = aImplIsoLangEntries;
+ const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
do
{
if ( pEntry->mnLang == nLang )
@@ -705,7 +705,7 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
// -----------------------------------------------------------------------
-static const IsoLangEntry & lcl_lookupFallbackEntry(
+static const IsoLanguageCountryEntry & lcl_lookupFallbackEntry(
const ::com::sun::star::lang::Locale & rLocale )
{
// language is lower case in table
@@ -715,8 +715,8 @@ static const IsoLangEntry & lcl_lookupFallbackEntry(
sal_Int32 nCountryLen = aUpperCountry.getLength();
// Search for locale and remember first lang-only.
- const IsoLangEntry* pFirstLang = NULL;
- const IsoLangEntry* pEntry = aImplIsoLangEntries;
+ const IsoLanguageCountryEntry* pFirstLang = NULL;
+ const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
do
{
if (aLowerLang.equalsAscii( pEntry->maLanguage))
@@ -772,7 +772,7 @@ static const IsoLangEntry & lcl_lookupFallbackEntry(
::com::sun::star::lang::Locale MsLangId::Conversion::lookupFallbackLocale(
const ::com::sun::star::lang::Locale & rLocale )
{
- const IsoLangEntry& rEntry = lcl_lookupFallbackEntry( rLocale);
+ const IsoLanguageCountryEntry& rEntry = lcl_lookupFallbackEntry( rLocale);
return ::com::sun::star::lang::Locale(
OUString::createFromAscii( rEntry.maLanguage),
OUString::createFromAscii( rEntry.maCountry),
@@ -805,8 +805,8 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
OUString aUpperCountry = rCountry.toAsciiUpperCase();
// first look for exact match
- const IsoLangEntry* pFirstLang = NULL;
- const IsoLangEntry* pEntry = aImplIsoLangEntries;
+ const IsoLanguageCountryEntry* pFirstLang = NULL;
+ const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries;
do
{
if ( aLowerLang.equalsAscii( pEntry->maLanguage ) )
@@ -870,7 +870,7 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
// (to allow reading country and language in separate steps, in any order)
if ( !rCountry.isEmpty() && rLang.isEmpty() )
{
- const IsoLangEntry* pEntry2 = aImplIsoLangEntries;
+ const IsoLanguageCountryEntry* pEntry2 = aImplIsoLangEntries;
do
{
if ( aUpperCountry.equalsAscii( pEntry2->maCountry ) )
@@ -1000,7 +1000,7 @@ LanguageType MsLangId::convertUnxByteStringToLanguage(
::std::vector< MsLangId::LanguagetagMapping > MsLangId::getDefinedLanguagetags()
{
::std::vector< LanguagetagMapping > aVec;
- for (const IsoLangEntry* pEntry = aImplIsoLangEntries; pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
+ for (const IsoLanguageCountryEntry* pEntry = aImplIsoLangEntries; pEntry->mnLang != LANGUAGE_DONTKNOW; ++pEntry)
{
aVec.push_back( LanguagetagMapping( pEntry->getTagString(), pEntry->mnLang));
}
commit d457c322fb60e29964f139d628d5812b074fa559
Author: Eike Rathke <erack at redhat.com>
Date: Tue Aug 27 12:56:41 2013 +0200
mpLangStr to mpLanguage
Change-Id: Id9c88c9aee434872243a7738eeda1484e5727806
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index bdd4ea7..05f25ab 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -53,7 +53,7 @@ struct IsoLangNoneStdEntry
struct IsoLangOtherEntry
{
LanguageType mnLang;
- const sal_Char* mpLangStr;
+ const sal_Char* mpLanguage;
};
// -----------------------------------------------------------------------
@@ -693,7 +693,7 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
{
rLocale.Language = I18NLANGTAG_QLT;
rLocale.Country = OUString();
- rLocale.Variant = OUString::createFromAscii( pPrivateEntry->mpLangStr );
+ rLocale.Variant = OUString::createFromAscii( pPrivateEntry->mpLanguage );
return;
}
++pPrivateEntry;
@@ -787,7 +787,7 @@ LanguageType MsLangId::Conversion::convertPrivateUseToLanguage( const OUString&
const IsoLangOtherEntry* pPrivateEntry = aImplPrivateUseEntries;
do
{
- if ( rPriv.equalsIgnoreAsciiCaseAscii( pPrivateEntry->mpLangStr ) )
+ if ( rPriv.equalsIgnoreAsciiCaseAscii( pPrivateEntry->mpLanguage ) )
return pPrivateEntry->mnLang;
++pPrivateEntry;
} while ( pPrivateEntry->mnLang != LANGUAGE_DONTKNOW );
@@ -891,7 +891,7 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
const IsoLangOtherEntry* pOtherEntry = aImplOtherEntries;
do
{
- if ( aLowerLang.equalsAscii( pOtherEntry->mpLangStr ) )
+ if ( aLowerLang.equalsAscii( pOtherEntry->mpLanguage ) )
return pOtherEntry->mnLang;
++pOtherEntry;
}
commit b41e2788f54e15d1f12d9b18fef04917509ff5e1
Author: Eike Rathke <erack at redhat.com>
Date: Tue Aug 27 12:51:17 2013 +0200
maLangStr to maLanguage
this always annoyed me ...
Change-Id: I41223ca728a7d87dd6987027740817e3af31aeb2
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index 0373548..bdd4ea7 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -30,7 +30,7 @@
struct IsoLangEntry
{
LanguageType mnLang;
- sal_Char maLangStr[4];
+ sal_Char maLanguage[4];
sal_Char maCountry[3];
/** Obtain a language tag string with '-' separator. */
@@ -46,7 +46,7 @@ struct IsoLangEngEntry
struct IsoLangNoneStdEntry
{
LanguageType mnLang;
- sal_Char maLangStr[4];
+ sal_Char maLanguage[4];
sal_Char maCountry[9];
};
@@ -540,9 +540,9 @@ static IsoLangEntry aLastResortFallbackEntry =
OUString IsoLangEntry::getTagString() const
{
if (maCountry[0])
- return OUString( OUString::createFromAscii( maLangStr) + "-" + OUString::createFromAscii( maCountry));
+ return OUString( OUString::createFromAscii( maLanguage) + "-" + OUString::createFromAscii( maCountry));
else
- return OUString::createFromAscii( maLangStr);
+ return OUString::createFromAscii( maLanguage);
}
// -----------------------------------------------------------------------
@@ -676,7 +676,7 @@ void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
{
if ( pEntry->mnLang == nLang )
{
- rLocale.Language = OUString::createFromAscii( pEntry->maLangStr );
+ rLocale.Language = OUString::createFromAscii( pEntry->maLanguage );
rLocale.Country = OUString::createFromAscii( pEntry->maCountry );
rLocale.Variant = OUString();
return;
@@ -719,7 +719,7 @@ static const IsoLangEntry & lcl_lookupFallbackEntry(
const IsoLangEntry* pEntry = aImplIsoLangEntries;
do
{
- if (aLowerLang.equalsAscii( pEntry->maLangStr))
+ if (aLowerLang.equalsAscii( pEntry->maLanguage))
{
if (*pEntry->maCountry)
{
@@ -755,7 +755,7 @@ static const IsoLangEntry & lcl_lookupFallbackEntry(
pEntry = pFirstLang;
do
{
- if (aLowerLang.equalsAscii( pEntry->maLangStr))
+ if (aLowerLang.equalsAscii( pEntry->maLanguage))
{
if (*pEntry->maCountry)
return *pEntry;
@@ -774,7 +774,7 @@ static const IsoLangEntry & lcl_lookupFallbackEntry(
{
const IsoLangEntry& rEntry = lcl_lookupFallbackEntry( rLocale);
return ::com::sun::star::lang::Locale(
- OUString::createFromAscii( rEntry.maLangStr),
+ OUString::createFromAscii( rEntry.maLanguage),
OUString::createFromAscii( rEntry.maCountry),
OUString());
}
@@ -809,7 +809,7 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
const IsoLangEntry* pEntry = aImplIsoLangEntries;
do
{
- if ( aLowerLang.equalsAscii( pEntry->maLangStr ) )
+ if ( aLowerLang.equalsAscii( pEntry->maLanguage ) )
{
if ( aUpperCountry.isEmpty() ||
aUpperCountry.equalsAscii( pEntry->maCountry ) )
@@ -840,7 +840,7 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
const IsoLangNoneStdEntry* pNoneStdEntry = aImplIsoNoneStdLangEntries;
do
{
- if ( aLowerLang.equalsAscii( pNoneStdEntry->maLangStr ) )
+ if ( aLowerLang.equalsAscii( pNoneStdEntry->maLanguage ) )
{
// The countries in this table are not all in upper case
if ( aUpperCountry.equalsIgnoreAsciiCaseAscii( pNoneStdEntry->maCountry ) )
@@ -852,7 +852,7 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rL
pNoneStdEntry = aImplIsoNoneStdLangEntries2;
do
{
- if ( aLowerLang.equalsAscii( pNoneStdEntry->maLangStr ) )
+ if ( aLowerLang.equalsAscii( pNoneStdEntry->maLanguage ) )
{
// The countries in this table are not all in upper case
if ( aUpperCountry.equalsIgnoreAsciiCaseAscii( pNoneStdEntry->maCountry ) )
@@ -916,7 +916,7 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OString& rLa
struct IsoLangGLIBCModifiersEntry
{
LanguageType mnLang;
- sal_Char maLangStr[4];
+ sal_Char maLanguage[4];
sal_Char maCountry[3];
sal_Char maAtString[9];
};
@@ -978,7 +978,7 @@ LanguageType MsLangId::convertUnxByteStringToLanguage(
const IsoLangGLIBCModifiersEntry* pGLIBCModifiersEntry = aImplIsoLangGLIBCModifiersEntries;
do
{ // avoid embedded \0 warning
- if (aLowerLang.equals( static_cast< const char* >( pGLIBCModifiersEntry->maLangStr )) &&
+ if (aLowerLang.equals( static_cast< const char* >( pGLIBCModifiersEntry->maLanguage )) &&
aAtString.equals( static_cast< const char* >( pGLIBCModifiersEntry->maAtString )))
{
if (aUpperCountry.isEmpty() ||
More information about the Libreoffice-commits
mailing list