[Libreoffice-commits] core.git: use LanguageTag instead of comphelper::Locale

Stephan Bergmann sbergman at redhat.com
Thu Mar 28 10:28:30 PDT 2013


On 03/28/2013 01:39 AM, Eike Rathke wrote:
> commit 4f79c03ba8ca14c3b9798565272a82e4e14ac3d0
> Author: Eike Rathke<erack at redhat.com>
> Date:   Wed Mar 27 22:49:35 2013 +0100
>
>      use LanguageTag instead of comphelper::Locale
>
>      Change-Id: I98cac783ff1db94d1d7135dd0db8ee0d809b3457
>
> diff --git a/configmgr/source/configurationprovider.cxx b/configmgr/source/configurationprovider.cxx
> index 84f9456..bd84e8c 100644
> --- a/configmgr/source/configurationprovider.cxx
> +++ b/configmgr/source/configurationprovider.cxx
> @@ -57,6 +57,8 @@
>   #include "rtl/ustring.h"
>   #include "rtl/ustring.hxx"
>
> +#include <i18npool/languagetag.hxx>
> +
>   #include "components.hxx"
>   #include "configurationprovider.hxx"
>   #include "lock.hxx"
> @@ -337,20 +339,10 @@ 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_ == "*" ) {
> +    if ( locale_ == "*" ) {     /* FIXME-BCP47: WTF is this?!? */

A configuration provider can operate in one of two modes with regards to 
localized properties.  It can either be set up to use a specific locale, 
and return the best matching localized value for a given localized 
property.  Or it can be set up (via "*") to treat localized properties 
like sets, where each individual localized value is accessible under the 
locale's name.

Stephan

>           loc.Language = locale_;
>       } else if (! locale_.isEmpty()) {
> -        try {
> -            comphelper::Locale l(locale_);
> -            loc.Language = l.getLanguage();
> -            loc.Country = l.getCountry();
> -            loc.Variant = l.getVariant();
> -        } catch (comphelper::Locale::MalFormedLocaleException & e) {
> -            throw css::uno::RuntimeException(
> -                (OUString("MalformedLocaleException: ") +
> -                 e.Message),
> -                static_cast< cppu::OWeakObject * >(this));
> -        }
> +        loc = LanguageTag( locale_).getLocale( false);
>       }
>       return loc;
>   }



More information about the LibreOffice mailing list