i18nlangtag/source/isolang/isolang.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+)
New commits: commit fd45045cc3029b41c02a2634e6fe2e5456f716ad Author: Eike Rathke <er...@redhat.com> AuthorDate: Wed May 25 20:26:28 2022 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Thu May 26 01:48:31 2022 +0200 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 <er...@redhat.com> 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;