diff options
-rw-r--r-- | i18nlangtag/source/isolang/isolang.cxx | 14 | ||||
-rw-r--r-- | i18nlangtag/source/isolang/mslangid.cxx | 7 | ||||
-rw-r--r-- | include/i18nlangtag/mslangid.hxx | 6 |
3 files changed, 20 insertions, 7 deletions
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx index 3eb2d2550ecd..9722700c8d94 100644 --- a/i18nlangtag/source/isolang/isolang.cxx +++ b/i18nlangtag/source/isolang/isolang.cxx @@ -875,6 +875,20 @@ LanguageType MsLangId::Conversion::convertPrivateUseToLanguage( const OUString& // static +LanguageType MsLangId::Conversion::convertLocaleToLanguageImpl( + const ::com::sun::star::lang::Locale& rLocale ) +{ + /* FIXME: this x-... is temporary until conversion will be moved up to + * LanguageTag. Also handle the nasty "*" joker as privateuse. */ + LanguageType nRet = ((!rLocale.Variant.isEmpty() && + (rLocale.Variant.startsWithIgnoreAsciiCase( "x-") || (rLocale.Variant == "*"))) ? + convertPrivateUseToLanguage( rLocale.Variant) : + convertIsoNamesToLanguage( rLocale.Language, rLocale.Country)); + return nRet; +} + + +// static LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OUString& rLang, const OUString& rCountry ) { diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx index a4daef86af92..6e816ee3dde7 100644 --- a/i18nlangtag/source/isolang/mslangid.cxx +++ b/i18nlangtag/source/isolang/mslangid.cxx @@ -169,12 +169,7 @@ LanguageType MsLangId::Conversion::convertLocaleToLanguage( if (rLocale.Language.isEmpty()) return LANGUAGE_SYSTEM; - /* FIXME: this x-... is temporary until conversion will be moved up to - * LanguageTag. Also handle the nasty "*" joker as privateuse. */ - LanguageType nRet = ((!rLocale.Variant.isEmpty() && - (rLocale.Variant.startsWithIgnoreAsciiCase( "x-") || (rLocale.Variant == "*"))) ? - convertPrivateUseToLanguage( rLocale.Variant) : - convertIsoNamesToLanguage( rLocale.Language, rLocale.Country)); + LanguageType nRet = convertLocaleToLanguageImpl( rLocale); if (nRet == LANGUAGE_DONTKNOW) nRet = LANGUAGE_SYSTEM; diff --git a/include/i18nlangtag/mslangid.hxx b/include/i18nlangtag/mslangid.hxx index 14386eccc504..6be7e66eed40 100644 --- a/include/i18nlangtag/mslangid.hxx +++ b/include/i18nlangtag/mslangid.hxx @@ -212,7 +212,11 @@ public: I18NLANGTAG_DLLPRIVATE static LanguageType convertLocaleToLanguage( const ::com::sun::star::lang::Locale & rLocale ); - /** Convert x-... privateuse, used by convertLocaleToLanguage(Locale) */ + /** Used by convertLocaleToLanguage(Locale) */ + I18NLANGTAG_DLLPRIVATE static LanguageType convertLocaleToLanguageImpl( + const ::com::sun::star::lang::Locale & rLocale ); + + /** Convert x-... privateuse, used by convertLocaleToLanguageImpl(Locale) */ I18NLANGTAG_DLLPRIVATE static LanguageType convertPrivateUseToLanguage( const OUString& rPriv ); |