After some research, I conclude that it is necessary to utilise iso-codes to get the language name from the language code when the locale is missing.
It is possible to get a locale language name with something like the ln_langinfo_l
function and _NL_IDENTIFICATION_LANGUAGE
from an existing locale. However, when the locale was not generated or cannot be accessed, I do not see how to get the value with glibc.
Evolution parses an ISO 639 XML data file from iso-codes and uses it to get language names for language codes. Evolution translates the language name into the language of the current locale with dgettext
. A side note: iso-codes deprecated XML files in favour of JSON data. Evolution implements a wrapper around Enchant. Enchant identifies dictionaries by language codes, so Evolution derives the language names separately with iso-codes data.
gspell is a GTK library that uses Enchant to provide spellchecking GUI elements and dialogues. However, the stable release of gspell is currently for GTK 3, which I assume to be a problem for potential use in GTK 4 applications, including Epiphany, unless the GTK 4 version becomes stable at any time in the future.
gspell provides the language names by utilising ICU. A comment in the code of gspell states that it used iso-codes in the past but switched to ICU to simplify non-Linux packaging. So, there seems to be no apparent advantage to choosing ICU over iso-codes for Epiphany, which already has iso-codes among its dependencies.