From 34af964c640c14db9f4890414641595e9af34696 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 5 Sep 2013 14:20:03 +0200 Subject: use get*LocaleServiceName Change-Id: I24e10da4b511d0413268fe31ed02afe5f3b3734e --- .../source/textconversion/textconversionImpl.cxx | 26 ++++++++++++---------- 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'i18npool') 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 #include +#include +#include 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()) -- cgit