summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2023-01-05 18:12:59 +0100
committerEike Rathke <erack@redhat.com>2023-01-06 14:12:04 +0000
commitb959a2290f218dcae081d30e9da11c5a602ba5a5 (patch)
tree5eaef807d7c2d9898af906baca2705eea503db5d
parentRelated: tdf#152781 Add also non-on-the-fly IDs to language list (diff)
downloadcore-b959a2290f218dcae081d30e9da11c5a602ba5a5.tar.gz
core-b959a2290f218dcae081d30e9da11c5a602ba5a5.zip
Related: tdf#152781 Stab the 0xE40A {es} vs Latin America quirk
First, the LANGUAGE_SPANISH_LATIN_AMERICA 0xE40A is not a MS system LCID, it is Spanish 0x00a with sublanguage 0x39 => user defined (in the range 0x20 to 0x3f). Meanwhile MS reserved 0x580A for {es-419}, so obsolete the legacy 0xE40A definition and replace with 0x580A when encountered. Second, due to the legacy plain {es} mapping being present, an encountered 'es' (from our bundled dictionary extension) got mapped to 0xE40A instead of 0xA and thus was added to the character language listbox (that otherwise suppresses LCIDs without sublanguage), resulting in a "Spanish {es}" entry. Besides, it's currently not clear how to actually proceed with such dictionary situation when, for example, both 'es-ES' and 'es' dictionaries are present and the 'es' dictionary apparently is meant as base and contains entries the 'es-ES' does not or 'es-ES' overrides entries. It might be it's handled half-way in linguistics, but maybe not even that, I didn't investigate. Change-Id: Id859731ba5efa65d4a6de429b7f52027aa69327c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145093 Reviewed-by: Eike Rathke <erack@redhat.com> Tested-by: Jenkins (cherry picked from commit 375630ae76f46c096421dfadee8d37b406bc10c5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145114
-rw-r--r--i18nlangtag/source/isolang/isolang.cxx3
-rw-r--r--i18nlangtag/source/isolang/mslangid.cxx2
-rw-r--r--include/i18nlangtag/lang.h3
3 files changed, 6 insertions, 2 deletions
diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx
index c5259a53886d..2bd6b5e5e229 100644
--- a/i18nlangtag/source/isolang/isolang.cxx
+++ b/i18nlangtag/source/isolang/isolang.cxx
@@ -273,7 +273,6 @@ IsoLanguageCountryEntry const aImplIsoLangEntries[] =
{ LANGUAGE_SPANISH_NICARAGUA, "es", "NI", k0 },
{ LANGUAGE_SPANISH_PUERTO_RICO, "es", "PR", k0 },
{ LANGUAGE_SPANISH_UNITED_STATES, "es", "US", k0 },
- { LANGUAGE_SPANISH_LATIN_AMERICA, "es", "" , k0 },
{ LANGUAGE_TURKISH, "tr", "TR", k0 },
{ LANGUAGE_UKRAINIAN, "uk", "UA", k0 },
{ LANGUAGE_VIETNAMESE, "vi", "VN", k0 },
@@ -791,6 +790,8 @@ Bcp47CountryEntry const aImplBcp47CountryEntries[] =
// { LANGUAGE_YUE_CHINESE_HONGKONG, "zh-yue-HK", "HK", "", 0 }, // MS reserved, prefer yue-HK; do not add unless LanguageTag::simpleExtract() can handle it to not call liblangtag for rsc!
{ LANGUAGE_YIDDISH, "yi-001", "", "", k0 }, // MS since rev.15, was "yi-Hebr" reserved, "001"="World"
{ LANGUAGE_FRENCH_WEST_INDIES, "fr-029", "", "", k0 }, // MS since rev.15, was "Neither defined nor reserved", "029"="Caribbean"
+ { LANGUAGE_SPANISH_LATIN_AMERICA, "es-419", "", "", k0 }, // MS reserved since rev.15, "419"="Latin America and the Caribbean"
+ { LANGUAGE_OBSOLETE_USER_SPANISH_LATIN_AMERICA, "es-419", "", "", LANGUAGE_SPANISH_LATIN_AMERICA },
{ LANGUAGE_USER_INTERSLAVIC_LATIN, "art-Latn-x-interslv", "", "", k0 }, // see discussion in tdf#145853
{ LANGUAGE_USER_INTERSLAVIC_CYRILLIC, "art-Cyrl-x-interslv", "", "", k0 },
{ LANGUAGE_DONTKNOW, "", "", "", k0 } // marks end of table
diff --git a/i18nlangtag/source/isolang/mslangid.cxx b/i18nlangtag/source/isolang/mslangid.cxx
index 4e446d568858..cac12347fc54 100644
--- a/i18nlangtag/source/isolang/mslangid.cxx
+++ b/i18nlangtag/source/isolang/mslangid.cxx
@@ -567,6 +567,8 @@ LanguageType MsLangId::getReplacementForObsoleteLanguage( LanguageType nLang )
nLang = LANGUAGE_KURDISH_ARABIC_IRAQ;
else if (nLang == LANGUAGE_OBSOLETE_USER_SPANISH_CUBA)
nLang = LANGUAGE_SPANISH_CUBA;
+ else if (nLang == LANGUAGE_OBSOLETE_USER_SPANISH_LATIN_AMERICA)
+ nLang = LANGUAGE_SPANISH_LATIN_AMERICA;
// The following are not strictly obsolete but should be mapped to a
// replacement locale when encountered.
diff --git a/include/i18nlangtag/lang.h b/include/i18nlangtag/lang.h
index 158a7c7fe5be..59e20669cddd 100644
--- a/include/i18nlangtag/lang.h
+++ b/include/i18nlangtag/lang.h
@@ -389,7 +389,6 @@ namespace o3tl
#define LANGUAGE_SPANISH_EL_SALVADOR LanguageType(0x440A)
#define LANGUAGE_SPANISH_GUATEMALA LanguageType(0x100A)
#define LANGUAGE_SPANISH_HONDURAS LanguageType(0x480A)
-#define LANGUAGE_SPANISH_LATIN_AMERICA LanguageType(0xE40A) /* no locale possible */
#define LANGUAGE_SPANISH_MEXICAN LanguageType(0x080A)
#define LANGUAGE_SPANISH_MODERN LanguageType(0x0C0A)
#define LANGUAGE_SPANISH_NICARAGUA LanguageType(0x4C0A)
@@ -532,6 +531,8 @@ namespace o3tl
* that such a mapping exists in i18nlangtag/source/isolang/isolang.cxx, but
* mapping ISO back to LANGID will return the new value.
*/
+#define LANGUAGE_OBSOLETE_USER_SPANISH_LATIN_AMERICA LanguageType(0xE40A) /* no locale possible, legacy for es-419, makeLangID( 0x39, getPrimaryLanguage( LANGUAGE_SPANISH)) */
+#define LANGUAGE_SPANISH_LATIN_AMERICA LANGUAGE_es_419_reserved
#define LANGUAGE_OBSOLETE_USER_LATIN LanguageType(0x0610)
#define LANGUAGE_USER_LATIN LANGUAGE_LATIN
#define LANGUAGE_OBSOLETE_USER_LATIN_VATICAN LanguageType(0x8076) /* makeLangID( 0x20, getPrimaryLanguage( LANGUAGE_LATIN)) */