[PR #3138] refactor: single table for language mapping #3097

Open
opened 2026-10-15 04:07:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/amnezia-vpn/amnezia-client/pull/3138
Author: @SPTApyo
Created: 9/7/2026
Status: 🔄 Open

Base: dev ← Head: refactor/language-mapping


📝 Commits (4)

  • 4c41111 fix: add missing space in logging notification
  • 0d92140 refactor: single table for language mapping
  • 299aa79 refactor: enforce language table order at compile time
  • e3f2619 fix: realign catalogue source with the corrected logging string

📊 Changes

15 files changed (+97 additions, -112 deletions)

View changed files

📝 client/translations/amneziavpn_ar_EG.ts (+1 -1)
📝 client/translations/amneziavpn_es_ES.ts (+1 -1)
📝 client/translations/amneziavpn_fa_IR.ts (+1 -1)
📝 client/translations/amneziavpn_hi_IN.ts (+1 -1)
📝 client/translations/amneziavpn_ko_KR.ts (+1 -1)
📝 client/translations/amneziavpn_my_MM.ts (+1 -1)
📝 client/translations/amneziavpn_ru_RU.ts (+1 -1)
📝 client/translations/amneziavpn_uk_UA.ts (+1 -1)
📝 client/translations/amneziavpn_ur_PK.ts (+1 -1)
📝 client/translations/amneziavpn_zh_CN.ts (+1 -1)
📝 client/ui/controllers/languageUiController.cpp (+4 -71)
📝 client/ui/controllers/languageUiController.h (+0 -3)
📝 client/ui/models/languageModel.cpp (+36 -25)
📝 client/ui/models/languageModel.h (+46 -2)
📝 client/ui/qml/Pages2/PageStart.qml (+1 -1)

📄 Description

QLocale and AvailableLanguageEnum were mapped by five hand-maintained switch statements, and getLocalLanguageName existed twice, verbatim, in LanguageModel and LanguageUiController. Adding a language meant editing five places and silently getting a half-registered language if one was missed.

They are replaced by a single table in the LanguageSettings namespace plus three lookups. A Q_ASSERT in the model constructor keeps the table in enum order, which QML relies on to select a row by enum value.

Also included: a missing space in the logging notification that rendered as "automaticallydisabled".


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/amnezia-vpn/amnezia-client/pull/3138 **Author:** [@SPTApyo](https://github.com/SPTApyo) **Created:** 9/7/2026 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `refactor/language-mapping` --- ### 📝 Commits (4) - [`4c41111`](https://github.com/amnezia-vpn/amnezia-client/commit/4c411111cc2c106b2c692e83cbc8b60dc9e0698b) fix: add missing space in logging notification - [`0d92140`](https://github.com/amnezia-vpn/amnezia-client/commit/0d921403dccc10a59166f42583b9e6b3b156737a) refactor: single table for language mapping - [`299aa79`](https://github.com/amnezia-vpn/amnezia-client/commit/299aa79899534455774a60b9cac33d44ec9f0847) refactor: enforce language table order at compile time - [`e3f2619`](https://github.com/amnezia-vpn/amnezia-client/commit/e3f261975269cecb633f01fb7ff1580925a80d46) fix: realign catalogue source with the corrected logging string ### 📊 Changes **15 files changed** (+97 additions, -112 deletions) <details> <summary>View changed files</summary> 📝 `client/translations/amneziavpn_ar_EG.ts` (+1 -1) 📝 `client/translations/amneziavpn_es_ES.ts` (+1 -1) 📝 `client/translations/amneziavpn_fa_IR.ts` (+1 -1) 📝 `client/translations/amneziavpn_hi_IN.ts` (+1 -1) 📝 `client/translations/amneziavpn_ko_KR.ts` (+1 -1) 📝 `client/translations/amneziavpn_my_MM.ts` (+1 -1) 📝 `client/translations/amneziavpn_ru_RU.ts` (+1 -1) 📝 `client/translations/amneziavpn_uk_UA.ts` (+1 -1) 📝 `client/translations/amneziavpn_ur_PK.ts` (+1 -1) 📝 `client/translations/amneziavpn_zh_CN.ts` (+1 -1) 📝 `client/ui/controllers/languageUiController.cpp` (+4 -71) 📝 `client/ui/controllers/languageUiController.h` (+0 -3) 📝 `client/ui/models/languageModel.cpp` (+36 -25) 📝 `client/ui/models/languageModel.h` (+46 -2) 📝 `client/ui/qml/Pages2/PageStart.qml` (+1 -1) </details> ### 📄 Description QLocale and AvailableLanguageEnum were mapped by five hand-maintained switch statements, and getLocalLanguageName existed twice, verbatim, in LanguageModel and LanguageUiController. Adding a language meant editing five places and silently getting a half-registered language if one was missed. They are replaced by a single table in the LanguageSettings namespace plus three lookups. A Q_ASSERT in the model constructor keeps the table in enum order, which QML relies on to select a row by enum value. Also included: a missing space in the logging notification that rendered as "automaticallydisabled". --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
amnezia-vpn/amnezia-client#3097
No description provided.