summaryrefslogtreecommitdiff
path: root/i18nlangtag
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-10-31 09:07:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-10-31 13:09:29 +0100
commiteb5d232342b1d0f596b6e9c5f8df740a6ec614ff (patch)
tree9c5a4563ba98c427fa43aef7ee01581789708a66 /i18nlangtag
parent33a3de2f0ce2b18d8149dc68c3de16541adfc530 (diff)
loplugin:constantparam in i18nlangtag
Change-Id: I148a47a9b63b78651ec18cd947f45b8f4dbb9345 Reviewed-on: https://gerrit.libreoffice.org/44094 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'i18nlangtag')
-rw-r--r--i18nlangtag/source/isolang/mslangid.cxx30
-rw-r--r--i18nlangtag/source/languagetag/languagetag.cxx6
2 files changed, 15 insertions, 21 deletions
diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx
index 5e2df2ee86c4..6d4b98781640 100644
--- a/i18nlangtag/source/isolang/mslangid.cxx
+++ b/i18nlangtag/source/isolang/mslangid.cxx
@@ -144,26 +144,20 @@ LanguageType MsLangId::resolveSystemLanguageByScriptType( LanguageType nLang, sa
// static
css::lang::Locale MsLangId::Conversion::convertLanguageToLocale(
- LanguageType nLang, bool bResolveSystem )
+ LanguageType nLang )
{
css::lang::Locale aLocale;
- if (!bResolveSystem && simplifySystemLanguages( nLang) == LANGUAGE_SYSTEM)
- ; // nothing => empty locale
- else
+ // Still resolve LANGUAGE_DONTKNOW if resolving is not requested,
+ // but not LANGUAGE_SYSTEM or others.
+ LanguageType nOrigLang = nLang;
+ nLang = MsLangId::getRealLanguage(nLang);
+ convertLanguageToLocaleImpl( nLang, aLocale, true );
+ if (aLocale.Language.isEmpty() && simplifySystemLanguages(nOrigLang) == LANGUAGE_SYSTEM)
{
- // Still resolve LANGUAGE_DONTKNOW if resolving is not requested,
- // but not LANGUAGE_SYSTEM or others.
- LanguageType nOrigLang = nLang;
- if (bResolveSystem || nLang == LANGUAGE_DONTKNOW)
- nLang = MsLangId::getRealLanguage( nLang);
- convertLanguageToLocaleImpl( nLang, aLocale, true);
- if (bResolveSystem && aLocale.Language.isEmpty() && simplifySystemLanguages( nOrigLang) == LANGUAGE_SYSTEM)
- {
- // None found but resolve requested, last resort is "en-US".
- aLocale.Language = "en";
- aLocale.Country = "US";
- aLocale.Variant.clear();
- }
+ // None found but resolve requested, last resort is "en-US".
+ aLocale.Language = "en";
+ aLocale.Country = "US";
+ aLocale.Variant.clear();
}
return aLocale;
}
@@ -187,7 +181,7 @@ css::lang::Locale MsLangId::getFallbackLocale(
{
// empty language => LANGUAGE_SYSTEM
if (rLocale.Language.isEmpty())
- return Conversion::lookupFallbackLocale( Conversion::convertLanguageToLocale( LANGUAGE_SYSTEM, true));
+ return Conversion::lookupFallbackLocale( Conversion::convertLanguageToLocale( LANGUAGE_SYSTEM ));
else
return Conversion::lookupFallbackLocale( rLocale);
}
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx
index 1e65fe593f6d..3f887de7d6c1 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -961,7 +961,7 @@ LanguageTag::ImplPtr LanguageTag::registerImpl() const
// May have involved canonicalize(), so compare with
// pImpl->maBcp47 instead of maBcp47!
aBcp47 = LanguageTagImpl::convertToBcp47(
- MsLangId::Conversion::convertLanguageToLocale( pImpl->mnLangID, true));
+ MsLangId::Conversion::convertLanguageToLocale( pImpl->mnLangID ));
bInsert = (aBcp47 == pImpl->maBcp47);
}
}
@@ -1344,7 +1344,7 @@ void LanguageTagImpl::convertLocaleToBcp47()
// locale via LanguageTag::convertToBcp47(LanguageType) and
// LanguageTag::convertToLocale(LanguageType) would instantiate another
// LanguageTag.
- maLocale = MsLangId::Conversion::convertLanguageToLocale( LANGUAGE_SYSTEM, true);
+ maLocale = MsLangId::Conversion::convertLanguageToLocale( LANGUAGE_SYSTEM );
}
if (maLocale.Language.isEmpty())
{
@@ -1488,7 +1488,7 @@ void LanguageTagImpl::convertLangToLocale()
mbInitializedLangID = true;
}
// Resolve system here! The original is remembered as mbSystemLocale.
- maLocale = MsLangId::Conversion::convertLanguageToLocale( mnLangID, true);
+ maLocale = MsLangId::Conversion::convertLanguageToLocale( mnLangID );
mbInitializedLocale = true;
}