diff options
author | Eike Rathke <erack@redhat.com> | 2022-05-25 20:26:28 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2022-05-26 01:48:31 +0200 |
commit | fd45045cc3029b41c02a2634e6fe2e5456f716ad (patch) | |
tree | 9fe6eb4a9ec2c18aaea2bb3a297ec7e134ec80ec | |
parent | aee953d7b66c02bbd7034cbf8991e3748dc3794a (diff) |
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>
-rw-r--r-- | i18nlangtag/source/isolang/isolang.cxx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx index d374bcd62213..1e967015b285 100644 --- a/i18nlangtag/source/isolang/isolang.cxx +++ b/i18nlangtag/source/isolang/isolang.cxx @@ -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; |