tdf#173547: fix wrong alphabetical sorting for Kurdish Latn alphabetical

Following tdf#173579 by removing broken dynamic loading of collators,
I focused on Kurdish Latn collation.

Root cause and fix provided by GPT-5.6 Luna
Cause:
when "kmr-Latn-TR", LO uses Language "qlt", Country "TR" (Turkey), Variant "kmr-Latn-TR"
but "kmr-Latn-TR" wasn't used in LOCAL_RULE_LANGS (a variable generated in i18npool/CustomTarget_collator.mk)
and used in i18npool/source/collator/collator_unicode.cxx, method Collator_Unicode::loadCollatorAlgorithm
so "func" and "funclen" weren't initialized with appropriate collator functions.

Fix:
rename file and functions containing "ku" by using "kmr_Latn"
(I suppose the right move since it mimics Eike Rathke's commit 45d4b9b5e3
"renamed ku* to kmr-Latn*, fdo#63460")

Add a specific use case bKmrLatn to load "kmr_Latn" collator functions
to deal with "qlt" language (yes it's a bit kludgy...)

We must remind that "kmr_Latn" can be used for "kmr_Latn_TR" but also with "kmr_Latn_SY"
that's why I avoided using "kmr_Latn_TR"

Also, to avoid the bKmrLatn specific case,
I thought about changing "LangID" tag of i18npool/source/localedata/data/kmr_Latn_TR.xml
from "qlt" into "kmr-Latn" but I'm not sure of the impact.

Change-Id: Ifc608da19b4bd2d05667121e3c6f2455f5d45ca9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210977
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet
2026-09-21 22:34:45 +02:00
parent 7b431c1688
commit 790dd1d0c6
5 changed files with 19 additions and 16 deletions
+1 -1
View File
@@ -38,8 +38,8 @@
#define WITH_LOCALE_hu 0
#define WITH_LOCALE_is 0
#define WITH_LOCALE_ja 0
#define WITH_LOCALE_kmr_Latn 0
#define WITH_LOCALE_ko 0
#define WITH_LOCALE_ku 0
#define WITH_LOCALE_ln 0
#define WITH_LOCALE_my 0
#define WITH_LOCALE_ne 0
+2 -2
View File
@@ -26,8 +26,8 @@ i18npool_COTXTS := \
$(call gb_Helper_optional_locale,ko, \
ko_charset.txt) \
) \
$(call gb_Helper_optional_locale,ku, \
ku_alphanumeric.txt) \
$(call gb_Helper_optional_locale,kmr_Latn, \
kmr_Latn_alphanumeric.txt) \
$(call gb_Helper_optional_locale,ln, \
ln_charset.txt) \
$(call gb_Helper_optional_locale,my, \
+2 -2
View File
@@ -79,8 +79,8 @@ extern "C" {
const sal_uInt8* get_collator_data_ja_charset();
const sal_uInt8* get_collator_data_ja_phonetic_alphanumeric_first();
const sal_uInt8* get_collator_data_ja_phonetic_alphanumeric_last();
const sal_uInt8* get_collator_data_kmr_Latn_alphanumeric();
const sal_uInt8* get_collator_data_ko_charset();
const sal_uInt8* get_collator_data_ku_alphanumeric();
const sal_uInt8* get_collator_data_ln_charset();
const sal_uInt8* get_collator_data_my_dictionary();
const sal_uInt8* get_collator_data_ne_charset();
@@ -102,8 +102,8 @@ extern "C" {
size_t get_collator_data_ja_charset_length();
size_t get_collator_data_ja_phonetic_alphanumeric_first_length();
size_t get_collator_data_ja_phonetic_alphanumeric_last_length();
size_t get_collator_data_kmr_Latn_alphanumeric_length();
size_t get_collator_data_ko_charset_length();
size_t get_collator_data_ku_alphanumeric_length();
size_t get_collator_data_ln_charset_length();
size_t get_collator_data_my_dictionary_length();
size_t get_collator_data_ne_charset_length();
+14 -11
View File
@@ -81,10 +81,21 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
throw RuntimeException(message);
}
}
if (!collator && OUString(LOCAL_RULE_LANGS).indexOf(rLocale.Language) >= 0) {
const sal_uInt8* (*func)() = nullptr;
size_t (*funclen)() = nullptr;
const sal_uInt8* (*func)() = nullptr;
size_t (*funclen)() = nullptr;
bool bKmrLatn = false;
#if WITH_LOCALE_ALL || WITH_LOCALE_kmr_Latn
// tdf#173547: specific case for Kurdish Latin (it could be "kmr-Latn-TR" but also "kmr-Latn-SY")
bKmrLatn = rLocale.Language == "qlt" && rLocale.Variant.startsWith("kmr-Latn") && rAlgorithm == "alphanumeric";
if (bKmrLatn) {
func = get_collator_data_kmr_Latn_alphanumeric;
funclen = get_collator_data_kmr_Latn_alphanumeric_length;
}
#endif
if (!collator && (OUString(LOCAL_RULE_LANGS).indexOf(rLocale.Language) >= 0 || bKmrLatn)) {
if (false) {
;
#if WITH_LOCALE_ALL || WITH_LOCALE_ca
@@ -138,14 +149,6 @@ Collator_Unicode::loadCollatorAlgorithm(const OUString& rAlgorithm, const lang::
funclen = get_collator_data_ja_phonetic_alphanumeric_last_length;
}
#endif
#if WITH_LOCALE_ALL || WITH_LOCALE_ku
} else if ( rLocale.Language == "ku" ) {
if ( rAlgorithm == "alphanumeric" )
{
func = get_collator_data_ku_alphanumeric;
funclen = get_collator_data_ku_alphanumeric_length;
}
#endif
#if WITH_LOCALE_ALL || WITH_LOCALE_ln
} else if ( rLocale.Language == "ln" ) {
if ( rAlgorithm == "charset" )