summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-09-05 11:39:59 +0200
committerEike Rathke <erack@redhat.com>2013-09-05 14:57:25 +0200
commitf7002026d91bde71c4baceb3ff0bd318a45bf72d (patch)
treebe8b211fc3b8c6588f2d7fa8c47053b0fe0b04d0 /i18npool
parentacd09adae4c53cfb6b70ff2146f97043ce1487dd (diff)
use get*LocaleServiceName
Change-Id: Ieb286027644446c1109ab4fc637445c3582e316e
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/localedata/localedata.cxx50
1 files changed, 12 insertions, 38 deletions
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx
index 2b5ed9e93a0e..f453052b5219 100644
--- a/i18npool/source/localedata/localedata.cxx
+++ b/i18npool/source/localedata/localedata.cxx
@@ -453,12 +453,8 @@ oslGenericFunction SAL_CALL lcl_LookupTableHelper::getFunctionSymbolByName(
Locale aFbLocale = MsLangId::getFallbackLocale( aLocale);
if (aFbLocale == aLocale)
bFallback = false; // may be a "language-only-locale" like Interlingua (ia)
- else if (!aFbLocale.Country.isEmpty()) {
- OUStringBuffer aBuf(5);
- aFallback = aBuf.append(aFbLocale.Language).append( under).append(aFbLocale.Country).makeStringAndClear();
- }
else
- aFallback = aFbLocale.Language;
+ aFallback = LocaleData::getFirstLocaleServiceName( aFbLocale);
}
for ( sal_Int16 i = 0; i < nbOfLocales; i++)
@@ -1474,44 +1470,22 @@ oslGenericFunction SAL_CALL LocaleData::getFunctionSymbol( const Locale& rLocale
}
oslGenericFunction pSymbol = 0;
-
- sal_Int32 l = rLocale.Language.getLength();
- sal_Int32 c = rLocale.Country.getLength();
- sal_Int32 v = rLocale.Variant.getLength();
- aBuf.ensureCapacity(l+c+v+3);
-
LocaleDataLookupTableItem *pCachedItem = 0;
- if (l > 0 && c > 0 && v > 0)
- {
- // load function with name <func>_<lang>_<country>_<variant>
- pSymbol = rLookupTable.getFunctionSymbolByName(
- aBuf.append(rLocale.Language).append(under).append(rLocale.Country).append(under).append(rLocale.Variant).makeStringAndClear(),
- pFunction, &pCachedItem);
- }
-
- if (!pSymbol && l > 0 && c > 0)
- {
- // load function with name <ase>_<lang>_<country>
- pSymbol = rLookupTable.getFunctionSymbolByName(
- aBuf.append(rLocale.Language).append(under).append(rLocale.Country).makeStringAndClear(),
- pFunction, &pCachedItem);
- }
-
- if (!pSymbol && l > 0 && c > 0 && rLocale.Language == "zh" && (rLocale.Country == "HK" || rLocale.Country == "MO"))
- {
- // if the country code is HK or MO, one more step to try TW.
- pSymbol = rLookupTable.getFunctionSymbolByName(
- aBuf.append(rLocale.Language).append(under).append("TW").makeStringAndClear(),
- pFunction, &pCachedItem);
- }
-
+ // Load function with name <func>_<lang>_<country> or <func>_<bcp47> and
+ // fallbacks.
+ pSymbol = rLookupTable.getFunctionSymbolByName( LocaleData::getFirstLocaleServiceName( rLocale),
+ pFunction, &pCachedItem);
if (!pSymbol)
{
- // load function with name <func>_<lang>
- pSymbol = rLookupTable.getFunctionSymbolByName(rLocale.Language, pFunction, &pCachedItem);
+ ::std::vector< OUString > aFallbacks( LocaleData::getFallbackLocaleServiceNames( rLocale));
+ for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it)
+ {
+ pSymbol = rLookupTable.getFunctionSymbolByName( *it, pFunction, &pCachedItem);
+ if (pSymbol)
+ break;
+ }
}
-
if (!pSymbol)
{
// load default function with name <func>_en_US