summaryrefslogtreecommitdiffstats
path: root/i18npool/source
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-09-05 10:07:32 +0200
committerEike Rathke <erack@redhat.com>2013-09-05 14:57:25 +0200
commitacd09adae4c53cfb6b70ff2146f97043ce1487dd (patch)
treee981da9253ea8dfabea59b402fa719841f877fa8 /i18npool/source
parentActually use table name in getIndexInfo. (firebird-sdbc) (diff)
downloadcore-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.cxx33
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: */