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
This commit is contained in:
Eike Rathke
2023-02-16 22:45:34 +00:00
parent 49445ccb89
commit a9b97301ba
2 changed files with 2 additions and 4 deletions
+1 -3
View File
@@ -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:
@@ -2382,7 +2382,7 @@ LanguageTag & LanguageTag::makeFallback()
}
// Original language-only.
if (aLanguage != maBcp47)
if (!aLanguage.isEmpty() && aLanguage != maBcp47)
aVec.push_back( aLanguage);
return aVec;