summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2013-09-05 14:20:03 +0200
committerEike Rathke <erack@redhat.com>2013-09-05 14:57:28 +0200
commit34af964c640c14db9f4890414641595e9af34696 (patch)
tree3a0856c39ae3d53b6d5090478724594cf74ca12a /i18npool
parentd066560a80edbfe9545414e6d05ffa6c21313f5c (diff)
use get*LocaleServiceName
Change-Id: I24e10da4b511d0413268fe31ed02afe5f3b3734e
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/textconversion/textconversionImpl.cxx26
1 files changed, 14 insertions, 12 deletions
diff --git a/i18npool/source/textconversion/textconversionImpl.cxx b/i18npool/source/textconversion/textconversionImpl.cxx
index 2c3a0c9a8cca..b143ca9d9680 100644
--- a/i18npool/source/textconversion/textconversionImpl.cxx
+++ b/i18npool/source/textconversion/textconversionImpl.cxx
@@ -20,6 +20,8 @@
#include <assert.h>
#include <textconversionImpl.hxx>
+#include <localedata.hxx>
+#include <i18nlangtag/languagetag.hxx>
using namespace com::sun::star::lang;
using namespace com::sun::star::uno;
@@ -85,21 +87,21 @@ TextConversionImpl::getLocaleSpecificTextConversion(const Locale& rLocale) throw
if (rLocale != aLocale) {
aLocale = rLocale;
+ OUString aPrefix("com.sun.star.i18n.TextConversion_");
Reference < XInterface > xI;
xI = m_xContext->getServiceManager()->createInstanceWithContext(
- OUString("com.sun.star.i18n.TextConversion_") + aLocale.Language, m_xContext);
-
- if ( ! xI.is() )
- xI = m_xContext->getServiceManager()->createInstanceWithContext(
- OUString("com.sun.star.i18n.TextConversion_") + aLocale.Language +
- OUString("_") + aLocale.Country, m_xContext);
- if ( ! xI.is() )
- xI = m_xContext->getServiceManager()->createInstanceWithContext(
- OUString("com.sun.star.i18n.TextConversion_") + aLocale.Language +
- OUString("_") + aLocale.Country +
- OUString("_") + aLocale.Variant, m_xContext);
-
+ aPrefix + LocaleDataImpl::getFirstLocaleServiceName( aLocale), m_xContext);
+ if (!xI.is())
+ {
+ ::std::vector< OUString > aFallbacks( LocaleDataImpl::getFallbackLocaleServiceNames( aLocale));
+ for (::std::vector< OUString >::const_iterator it( aFallbacks.begin()); it != aFallbacks.end(); ++it)
+ {
+ xI = m_xContext->getServiceManager()->createInstanceWithContext( aPrefix + *it, m_xContext);
+ if (xI.is())
+ break;
+ }
+ }
if (xI.is())
xTC.set( xI, UNO_QUERY );
else if (xTC.is())