diff options
author | Eike Rathke <erack@redhat.com> | 2013-09-05 10:07:32 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-09-05 14:57:25 +0200 |
commit | acd09adae4c53cfb6b70ff2146f97043ce1487dd (patch) | |
tree | e981da9253ea8dfabea59b402fa719841f877fa8 /i18npool/source | |
parent | Actually use table name in getIndexInfo. (firebird-sdbc) (diff) | |
download | core-acd09adae4c53cfb6b70ff2146f97043ce1487dd.tar.gz core-acd09adae4c53cfb6b70ff2146f97043ce1487dd.zip |
added getFirstLocaleServiceName() and getFallbackLocaleServiceNames()
Change-Id: I35d3c5baeb5501feacdfa146f5b7f4e4f1bba876
Diffstat (limited to 'i18npool/source')
-rw-r--r-- | i18npool/source/localedata/localedata.cxx | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index c980d2af8faf..2b5ed9e93a0e 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -20,6 +20,7 @@ #include <localedata.hxx> #include <i18nlangtag/mslangid.hxx> +#include <i18nlangtag/languagetag.hxx> #include <rtl/ustrbuf.hxx> #include <string.h> #include <stdio.h> @@ -1656,4 +1657,36 @@ LocaleData::getSupportedServiceNames() throw( RuntimeException ) return aRet; } +// static +OUString LocaleData::getFirstLocaleServiceName( const com::sun::star::lang::Locale & rLocale ) +{ + if (rLocale.Language == I18NLANGTAG_QLT) + return rLocale.Variant.replaceAll( "-", "_"); + else if (!rLocale.Country.isEmpty()) + return rLocale.Language + "_" + rLocale.Country; + else + return rLocale.Language; +} + +// static +::std::vector< OUString > LocaleData::getFallbackLocaleServiceNames( const com::sun::star::lang::Locale & rLocale ) +{ + ::std::vector< OUString > aVec; + if (rLocale.Language == I18NLANGTAG_QLT) + { + aVec = LanguageTag( rLocale).getFallbackStrings(); + aVec.erase( aVec.begin()); + for (::std::vector< OUString >::iterator it(aVec.begin()); it != aVec.end(); ++it) + { + *it = (*it).replaceAll( "-", "_"); + } + } + else if (!rLocale.Country.isEmpty()) + { + aVec.push_back( rLocale.Language); + } + // else nothing, language-only was the first + return aVec; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |