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 /comphelper | |
parent | ce1cbedd471206b71a8f98f5ff63ce46e685dd5f (diff) |
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
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/Library_comphelper.mk | 1 | ||||
-rw-r--r-- | comphelper/source/misc/configuration.cxx | 28 |
2 files changed, 5 insertions, 24 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); |