summaryrefslogtreecommitdiff
path: root/comphelper/source/misc/configuration.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'comphelper/source/misc/configuration.cxx')
-rw-r--r--comphelper/source/misc/configuration.cxx28
1 files changed, 4 insertions, 24 deletions
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);