feat: sort languages in selection menu (#1071)

## Summary

* **What is the goal of this PR?** (e.g., Implements the new feature for
file uploading.)

Currently we are displaying the languages in the order they were added
(as in the `Language` enum). However, as new languages are coming in,
this will quickly be confusing to the users.

But we can't just change the ordering of the enum if we want to respect
bakwards compatibility.

So my proposal is to add a mapping of the alphabetical order of the
languages. I've made it so that it's generated by the `gen_i18n.py`
script, which will be used when a new language is added.


* **What changes are included?**

Added the array from the python script and changed
`LanguageSelectActivity` to use the indices from there. Also commited
the generated `I18nKeys.h`

## Additional Context

* Add any other information that might be helpful for the reviewer
(e.g., performance implications, potential risks,
  specific areas to focus on).

I was wondering if there is a better way to sort it. Currently, it's by
unicode value and Czech and Russian are last, which I don't know it it's
the most intuitive.

The current order is:
`Català, Deutsch, English, Español, Français, Português (Brasil),
Română, Svenska, Čeština, Русский`

---

### AI Usage

While CrossPoint doesn't have restrictions on AI tools in contributing,
please be transparent about their usage as it
helps set the right context for reviewers.

Did you use AI tools to help write this code? _**< PARTIALLY >**_
This commit is contained in:
ariel-lindemann
2026-02-25 17:44:17 +01:00
committed by GitHub
parent b695a48af6
commit 7e214ea760
19 changed files with 68 additions and 34 deletions

View File

@@ -89,7 +89,7 @@ void I18n::loadSettings() {
const char* I18n::getCharacterSet(Language lang) {
const auto langIndex = static_cast<size_t>(lang);
if (langIndex >= static_cast<size_t>(Language::_COUNT)) {
lang = Language::ENGLISH; // Fallback to first language
lang = Language::EN; // Fallback to first language
}
return CHARACTER_SETS[static_cast<size_t>(lang)];

View File

@@ -32,7 +32,7 @@ class I18n {
static const char* getCharacterSet(Language lang);
private:
I18n() : _language(Language::ENGLISH) {}
I18n() : _language(Language::EN) {}
Language _language;
};

View File

@@ -1,5 +1,5 @@
_language_name: "Беларуская"
_language_code: "BELARUSIAN"
_language_code: "BE"
_order: "11"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Català"
_language_code: "CATALAN"
_language_code: "CA"
_order: "9"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Čeština"
_language_code: "CZECH"
_language_code: "CS"
_order: "4"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "English"
_language_code: "ENGLISH"
_language_code: "EN"
_order: "0"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Français"
_language_code: "FRENCH"
_language_code: "FR"
_order: "2"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Deutsch"
_language_code: "GERMAN"
_language_code: "DE"
_order: "3"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Italiano"
_language_code: "ITALIAN"
_language_code: "IT"
_order: "12"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Português (Brasil)"
_language_code: "PORTUGUESE"
_language_code: "PT"
_order: "5"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Română"
_language_code: "ROMANIAN"
_language_code: "RO"
_order: "8"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Русский"
_language_code: "RUSSIAN"
_language_code: "RU"
_order: "6"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Español"
_language_code: "SPANISH"
_language_code: "ES"
_order: "1"
STR_CROSSPOINT: "CrossPoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Svenska"
_language_code: "SWEDISH"
_language_code: "SV"
_order: "7"
STR_CROSSPOINT: "Crosspoint"

View File

@@ -1,5 +1,5 @@
_language_name: "Українська"
_language_code: "UKRAINIAN"
_language_code: "UK"
_order: "10"
STR_CROSSPOINT: "CrossPoint"