convertLanguageToLocaleImpl() speed-up a gazillion en-US fallback cases

Change-Id: I7f9290383eabcf3733f15f8f45193ee04db9852f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134953
Tested-by: Jenkins
Reviewed-by: Eike Rathke <erack@redhat.com>
This commit is contained in:
Eike Rathke 2022-05-25 20:26:28 +02:00
parent aee953d7b6
commit fd45045cc3

View file

@ -952,6 +952,16 @@ IsoLangOtherEntry const aImplPrivateUseEntries[] =
void MsLangId::Conversion::convertLanguageToLocaleImpl( LanguageType nLang,
css::lang::Locale & rLocale, bool bIgnoreOverride )
{
if (nLang == LANGUAGE_ENGLISH_US)
{
// Speed-up a gazillion fallback cases, not iterating through
// aImplBcp47CountryEntries nor aImplIsoLangScriptEntries.
rLocale.Language = "en";
rLocale.Country = "US";
rLocale.Variant.clear();
return;
}
const Bcp47CountryEntry* pBcp47EntryOverride = nullptr;
const IsoLanguageScriptCountryEntry* pScriptEntryOverride = nullptr;
const IsoLanguageCountryEntry* pEntryOverride = nullptr;