From beda01bf3a7f805aa3f90c51cad5732b0cb1cce0 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Mon, 2 Sep 2024 11:35:21 +0200 Subject: Add-In CompatibilityName: for "en-US" try the most likely fallback of "en" As this needs to be resolved for every occurrence of the function name during export to OOXML and .xls and Add-In authors tend to be lax with en-US vs en-GB, also because function names usually don't differ, and use "en" at least in DisplayName. Change-Id: If0b1b60c4806028c76296e5feaa74e7ddb307bb6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172735 Tested-by: Jenkins Reviewed-by: Eike Rathke (cherry picked from commit 79ed97b93be2711bab5530d8ddc18e318be644d9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172757 Reviewed-by: Xisco Fauli --- sc/source/core/tool/addincol.cxx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'sc') diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index e84a02802c01..ec1c53b22bf2 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -170,7 +170,19 @@ bool ScUnoAddInFuncData::GetExcelName( const LanguageTag& rDestLang, OUString& r return true; } - // Second, try match of fallback search with fallback locales, + // For "en-US" try the most likely fallback of "en". + if (aSearch == "en-US") + { + itNames = std::find_if(rCompNames.begin(), rCompNames.end(), + [](const LocalizedName& rName) { return rName.maLocale == "en"; }); + if (itNames != rCompNames.end()) + { + rRetExcelName = (*itNames).maName; + return true; + } + } + + // Try match of fallback search with fallback locales, // appending also 'en-US' and 'en' to search if not queried. ::std::vector< OUString > aFallbackSearch( rDestLang.getFallbackStrings( true)); if (aSearch != "en-US") @@ -196,7 +208,7 @@ bool ScUnoAddInFuncData::GetExcelName( const LanguageTag& rDestLang, OUString& r if (bFallbackToAny) { - // Third, last resort, use first (default) entry. + // Last resort, use first (default) entry. rRetExcelName = rCompNames[0].maName; return true; } -- cgit