configmgr/qa/unit/test.cxx                     |    4 +---
 i18nlangtag/source/languagetag/languagetag.cxx |    2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

New commits:
commit a9b97301ba75a74e6671a6b9829f7044e85db6af
Author:     Eike Rathke <er...@redhat.com>
AuthorDate: Thu Feb 16 01:28:17 2023 +0100
Commit:     Eike Rathke <er...@redhat.com>
CommitDate: Thu Feb 16 22:45:34 2023 +0000

    Do not add empty language tag to fallback strings
    
    This happened for known tags like es-419 but unhandled in
    simpleExtract(), which actually should be implemented as now a few
    are mapped as known tags. Prevent adding such empty string.
    
    For that, adjust configmgr/qa/unit/test.cxx to test for the
    expected "en-US" instead of "default".
    
    Change-Id: I05f8e35a9d88b42d45e1f2a90aecec5f4470cc79
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147135
    Reviewed-by: Eike Rathke <er...@redhat.com>
    Tested-by: Jenkins

diff --git a/configmgr/qa/unit/test.cxx b/configmgr/qa/unit/test.cxx
index fa380ab76dbf..217f386456ee 100644
--- a/configmgr/qa/unit/test.cxx
+++ b/configmgr/qa/unit/test.cxx
@@ -329,9 +329,7 @@ void Test::testLocalizedProperty() {
         OUString v;
         CPPUNIT_ASSERT(
             
access->getByHierarchicalName("/org.libreoffice.unittest/localized/*-") >>= v);
-        //TODO: "default" instead of "en-US" is presumably due to a bug in
-        // LanguageTag::getFallbackStrings, which returns an empty string:
-        CPPUNIT_ASSERT_EQUAL(OUString("default"), v);
+        CPPUNIT_ASSERT_EQUAL(OUString("en-US"), v);
     }
     {
         // Make sure a degenerate passed-in "-" locale is handled gracefully:
diff --git a/i18nlangtag/source/languagetag/languagetag.cxx 
b/i18nlangtag/source/languagetag/languagetag.cxx
index 3f4314a88fd2..1f097a23a840 100644
--- a/i18nlangtag/source/languagetag/languagetag.cxx
+++ b/i18nlangtag/source/languagetag/languagetag.cxx
@@ -2382,7 +2382,7 @@ LanguageTag & LanguageTag::makeFallback()
     }
 
     // Original language-only.
-    if (aLanguage != maBcp47)
+    if (!aLanguage.isEmpty() && aLanguage != maBcp47)
         aVec.push_back( aLanguage);
 
     return aVec;

Reply via email to