kiwix / libkiwix

Common code base for all Kiwix ports
https://download.kiwix.org/release/libkiwix/
GNU General Public License v3.0
118 stars 56 forks source link

`kiwix::ICULanguageInfo::selfName()` default to default locale instead of user locale. #1012

Open mgautierfr opened 11 months ago

mgautierfr commented 11 months ago

A locale may be known by ICU but without metadata about it (and so, no way to know how to name it in its own language).

Take for example crh which can be named in French or in English but we have no way to name things in crh (no crh.xml in https://github.com/unicode-org/cldr/blob/main/common/main/)

In this case, locale.getDisplayLanguage(locale, langSelfNameICUString); use the default/fallback language for the display name. It is English for library.kiwix.org but it can be changed with LANG env var.

In this case, we should fallback to the language of UI (specific to the user).

veloman-yunkan commented 7 months ago

This proposal, as formulated, contradicts the semantics of the language-self-name concept, which is an attribute of the concerned language only and is independent of the client. The right way to address that shortcoming with crh is to add its self-name in the iso639_3 map in languageTools.cpp.

By reading the intention behind this ticket I interpret it as a request to display in the current UI language those languages (coming from /catalog/v2/languages) that don't have a registered self-name. I don't agree with the exception clause. IMHO, if we make that enhancement it may be useful to always display both the self-name of a language and its translation-in-the-current-UI-language (if the latter is available).

kelson42 commented 4 months ago

@mgautierfr @veloman-yunkan Can we now what the exact user visible problem this proposal adresses? Afaik the languages are always displayed in their own langauge and we know how to handle this in case ICU does not have the info!

mgautierfr commented 4 months ago

Can we now what the exact user visible problem this proposal adresses?

In the case of crh, as ICU doesn't have the information to display crh in crh, it display crh in "the default language", so ("Crimean Tatar") for library.kiwix.org. But if you are in a french UI, it would be better to display it in French ("tatar de Crimée")

We should display a lang in the following language (by preference order):

Today we are displaying it in:

we know how to handle this in case ICU does not have the info!

Yes and we should still use it. But it need a explicit change in our code (and a release). By using UI language as first fallback, we somehow have a better UI "by default" until we add the info in our own code.

kelson42 commented 4 months ago

@mgautierfr Thanks, very clear to me now. I agree.