diff options
author | Eike Rathke <erack@redhat.com> | 2013-04-04 23:50:59 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2013-04-05 19:01:52 +0200 |
commit | 8ef9e38aa84675c57b331a796d900b3c10e04f44 (patch) | |
tree | 99f9e078a79e3f0747b93dfc36ecc89648f49a79 | |
parent | import RTF_LISTPICTURE and RTF_LEVELPICTURE (diff) | |
download | core-8ef9e38aa84675c57b331a796d900b3c10e04f44.tar.gz core-8ef9e38aa84675c57b331a796d900b3c10e04f44.zip |
use LanguageTag
This creates a circular dependency between modules i18npool and
comphelper, but not between libraries. To be resolved by moving
languagetag, isolang and mslangid stuff to a separate module.
Change-Id: I669aa66010800632c5637b42c6136a7ca14e7e68
-rw-r--r-- | comphelper/Library_comphelper.mk | 1 | ||||
-rw-r--r-- | comphelper/source/misc/configuration.cxx | 28 | ||||
-rw-r--r-- | configmgr/source/configurationprovider.cxx | 4 |
3 files changed, 6 insertions, 27 deletions
diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk index 648743be2804..0c01ca2ca8b0 100644 --- a/comphelper/Library_comphelper.mk +++ b/comphelper/Library_comphelper.mk @@ -48,6 +48,7 @@ $(eval $(call gb_Library_use_libraries,comphelper,\ sal \ salhelper \ ucbhelper \ + i18nisolang1 \ $(gb_UWINAPI) \ )) diff --git a/comphelper/source/misc/configuration.cxx b/comphelper/source/misc/configuration.cxx index e4bb82d0edb0..7e43bf1b0ea6 100644 --- a/comphelper/source/misc/configuration.cxx +++ b/comphelper/source/misc/configuration.cxx @@ -49,6 +49,7 @@ #include "rtl/instance.hxx" #include "rtl/ustrbuf.hxx" #include "rtl/ustring.hxx" +#include "i18npool/languagetag.hxx" namespace { @@ -62,32 +63,11 @@ struct TheConfigurationWrapper: OUString getDefaultLocale( css::uno::Reference< css::uno::XComponentContext > const & context) { - css::lang::Locale locale( + return LanguageTag( css::uno::Reference< css::lang::XLocalizable >( css::configuration::theDefaultProvider::get(context), css::uno::UNO_QUERY_THROW)-> - getLocale()); - OUStringBuffer buf; - SAL_WARN_IF( - locale.Language.indexOf('-') != -1, "comphelper", - "Locale language \"" << locale.Language << "\" contains \"-\""); - buf.append(locale.Language); - SAL_WARN_IF( - locale.Country.isEmpty() && !locale.Variant.isEmpty(), "comphelper", - "Locale has empty country but non-empty variant \"" << locale.Variant - << '"'); - if (!locale.Country.isEmpty()) { - buf.append('-'); - SAL_WARN_IF( - locale.Country.indexOf('-') != -1, "comphelper", - "Locale language \"" << locale.Country << "\" contains \"-\""); - buf.append(locale.Country); - if (!locale.Variant.isEmpty()) { - buf.append('-'); - buf.append(locale.Variant); - } - } - return buf.makeStringAndClear(); + getLocale()).getBcp47(); } OUString extendLocalizedPath(OUString const & path, OUString const & locale) { @@ -95,7 +75,7 @@ OUString extendLocalizedPath(OUString const & path, OUString const & locale) { buf.append("/['*"); SAL_WARN_IF( locale.match("*"), "comphelper", - "Locale \"" << locale << "\" starts with \"-\""); + "Locale \"" << locale << "\" starts with \"*\""); assert(locale.indexOf('&') == -1); assert(locale.indexOf('"') == -1); assert(locale.indexOf('\'') == -1); diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx index 2f6f075002c2..f4c04a0e7a55 100644 --- a/configmgr/source/configurationprovider.cxx +++ b/configmgr/source/configurationprovider.cxx @@ -337,9 +337,7 @@ void Service::setLocale(css::lang::Locale const & eLocale) css::lang::Locale Service::getLocale() throw (css::uno::RuntimeException) { osl::MutexGuard guard(*lock_); css::lang::Locale loc; - if ( locale_ == "*" ) { /* FIXME-BCP47: WTF is this?!? */ - loc.Language = locale_; - } else if (! locale_.isEmpty()) { + if (! locale_.isEmpty()) { loc = LanguageTag( locale_).getLocale( false); } return loc; |