sc/source/core/tool/addincol.cxx |   16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

New commits:
commit 79ed97b93be2711bab5530d8ddc18e318be644d9
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Mon Sep 2 11:35:21 2024 +0200
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Mon Sep 2 13:26:18 2024 +0200

    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 <er...@redhat.com>

diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx
index 131b493be0e3..b36f1cd07743 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;
         }

Reply via email to