Skip to content

Commit 7de7e54

Browse files
committed
Merge branch 'codex/global-distro-cli-hardening' into main
Resolved conflicts in QML files, adopting the new UI layout and improvements from the codex branch while maintaining compatibility with recent main updates.
2 parents 56ed147 + 1db2062 commit 7de7e54

10 files changed

Lines changed: 1736 additions & 5767 deletions

File tree

i18n/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ This directory contains the Qt Linguist translation sources for ro-Control.
77
- `ro-control_en.ts` - English source catalog kept in sync with extracted strings
88
- `ro-control_tr.ts` - Turkish translation catalog
99

10+
Additional catalogs (`ro-control_de.ts`, `ro-control_es.ts`) are maintained in the
11+
repository, but currently not shipped at runtime until translation coverage is
12+
completed.
13+
1014
English is the source language used directly in code. Additional locales should be
1115
added as new `ro-control_<locale>.ts` files.
1216

@@ -31,9 +35,9 @@ Example workflow:
3135
```bash
3236
mkdir -p build
3337
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
34-
lupdate src -ts i18n/ro-control_en.ts i18n/ro-control_tr.ts
38+
lupdate-qt6 -no-obsolete src -ts i18n/ro-control_en.ts i18n/ro-control_de.ts i18n/ro-control_es.ts i18n/ro-control_tr.ts
3539
linguist i18n/ro-control_tr.ts
36-
cmake --build build
40+
cmake --build build --target ro-control_lrelease
3741
```
3842

3943
## Adding a new language

i18n/ro-control_de.ts

Lines changed: 176 additions & 908 deletions
Large diffs are not rendered by default.

i18n/ro-control_en.ts

Lines changed: 306 additions & 1003 deletions
Large diffs are not rendered by default.

i18n/ro-control_es.ts

Lines changed: 176 additions & 908 deletions
Large diffs are not rendered by default.

i18n/ro-control_tr.ts

Lines changed: 314 additions & 1130 deletions
Large diffs are not rendered by default.

src/backend/system/languagemanager.cpp

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,21 @@ struct LanguageEntry {
1919
constexpr LanguageEntry kSupportedLanguages[] = {
2020
{"system", "System Default", "System Default", true},
2121
{"en", "English", "English", true},
22-
{"de", "German", "Deutsch", true},
23-
{"es", "Spanish", "Espanol", true},
22+
{"de", "German", "Deutsch", false},
23+
{"es", "Spanish", "Espanol", false},
2424
{"tr", "Turkish", "Turkce", true},
2525
};
2626

27+
bool isShippedLanguage(const QString &languageCode) {
28+
for (const auto &entry : kSupportedLanguages) {
29+
if (QString::fromLatin1(entry.code) == languageCode) {
30+
return entry.shipped;
31+
}
32+
}
33+
34+
return false;
35+
}
36+
2737
} // namespace
2838

2939
LanguageManager::LanguageManager(QCoreApplication *application,
@@ -57,6 +67,10 @@ QString LanguageManager::currentLanguageLabel() const {
5767
QVariantList LanguageManager::availableLanguages() const {
5868
QVariantList languages;
5969
for (const auto &entry : kSupportedLanguages) {
70+
if (!entry.shipped) {
71+
continue;
72+
}
73+
6074
QVariantMap language;
6175
language.insert(QStringLiteral("code"), QString::fromLatin1(entry.code));
6276
language.insert(QStringLiteral("label"), QString::fromLatin1(entry.label));
@@ -119,8 +133,15 @@ QString LanguageManager::systemLanguageCode() const {
119133
QString
120134
LanguageManager::effectiveLanguageCode(const QString &languageCode) const {
121135
const QString normalizedLanguage = normalizeLanguageCode(languageCode);
122-
return normalizedLanguage == QStringLiteral("system") ? systemLanguageCode()
123-
: normalizedLanguage;
136+
const QString effective = normalizedLanguage == QStringLiteral("system")
137+
? systemLanguageCode()
138+
: normalizedLanguage;
139+
140+
if (effective == QStringLiteral("en")) {
141+
return effective;
142+
}
143+
144+
return isShippedLanguage(effective) ? effective : QStringLiteral("en");
124145
}
125146

126147
bool LanguageManager::loadLanguage(const QString &languageCode) {

0 commit comments

Comments
 (0)