diff options
author | Eike Rathke <erack@redhat.com> | 2023-02-16 01:28:17 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2023-02-16 22:45:34 +0000 |
commit | a9b97301ba75a74e6671a6b9829f7044e85db6af (patch) | |
tree | ead0dd794c2ca603cca71dc58ff1b31a18c7364e | |
parent | 49445ccb891c6eb85b1d644c975c1b092ef00e43 (diff) |
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 <erack@redhat.com>
Tested-by: Jenkins
-rw-r--r-- | configmgr/qa/unit/test.cxx | 4 | ||||
-rw-r--r-- | i18nlangtag/source/languagetag/languagetag.cxx | 2 |
2 files changed, 2 insertions, 4 deletions
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; |