From 37c4f76988030cca46f307a4b51c9d2a3b18f5c9 Mon Sep 17 00:00:00 2001 From: Dav999 Date: Wed, 3 Jan 2024 19:07:28 +0100 Subject: [PATCH] Add RTL language property This doesn't have an effect yet, but it'll do things like right-alignment in textboxes and other design-flipping. --- desktop_version/lang/ca/meta.xml | 3 +++ desktop_version/lang/cy/meta.xml | 3 +++ desktop_version/lang/de/meta.xml | 3 +++ desktop_version/lang/en/meta.xml | 3 +++ desktop_version/lang/eo/meta.xml | 3 +++ desktop_version/lang/es/meta.xml | 3 +++ desktop_version/lang/fr/meta.xml | 3 +++ desktop_version/lang/ga/meta.xml | 3 +++ desktop_version/lang/it/meta.xml | 3 +++ desktop_version/lang/ja/meta.xml | 3 +++ desktop_version/lang/ko/meta.xml | 3 +++ desktop_version/lang/nl/meta.xml | 3 +++ desktop_version/lang/pl/meta.xml | 3 +++ desktop_version/lang/pt_BR/meta.xml | 3 +++ desktop_version/lang/pt_PT/meta.xml | 3 +++ desktop_version/lang/ru/meta.xml | 3 +++ desktop_version/lang/szl/meta.xml | 3 +++ desktop_version/lang/tr/meta.xml | 3 +++ desktop_version/lang/uk/meta.xml | 3 +++ desktop_version/lang/zh/meta.xml | 3 +++ desktop_version/lang/zh_TW/meta.xml | 3 +++ desktop_version/src/Localization.h | 1 + desktop_version/src/LocalizationMaint.cpp | 2 ++ desktop_version/src/LocalizationStorage.cpp | 3 +++ 24 files changed, 69 insertions(+) diff --git a/desktop_version/lang/ca/meta.xml b/desktop_version/lang/ca/meta.xml index b1d3cdd0..f0042590 100644 --- a/desktop_version/lang/ca/meta.xml +++ b/desktop_version/lang/ca/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/cy/meta.xml b/desktop_version/lang/cy/meta.xml index db7d955e..d85d4341 100644 --- a/desktop_version/lang/cy/meta.xml +++ b/desktop_version/lang/cy/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/de/meta.xml b/desktop_version/lang/de/meta.xml index 58958255..cc7237e2 100644 --- a/desktop_version/lang/de/meta.xml +++ b/desktop_version/lang/de/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/en/meta.xml b/desktop_version/lang/en/meta.xml index 9713da03..ef4fd119 100644 --- a/desktop_version/lang/en/meta.xml +++ b/desktop_version/lang/en/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/eo/meta.xml b/desktop_version/lang/eo/meta.xml index cc4e732b..1ca5af07 100644 --- a/desktop_version/lang/eo/meta.xml +++ b/desktop_version/lang/eo/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/es/meta.xml b/desktop_version/lang/es/meta.xml index 01582715..2c805b1d 100644 --- a/desktop_version/lang/es/meta.xml +++ b/desktop_version/lang/es/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/fr/meta.xml b/desktop_version/lang/fr/meta.xml index 809ca968..e34d568b 100644 --- a/desktop_version/lang/fr/meta.xml +++ b/desktop_version/lang/fr/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/ga/meta.xml b/desktop_version/lang/ga/meta.xml index a6fe2f64..4edd5dab 100644 --- a/desktop_version/lang/ga/meta.xml +++ b/desktop_version/lang/ga/meta.xml @@ -26,6 +26,9 @@ 1 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/it/meta.xml b/desktop_version/lang/it/meta.xml index 4301cad7..f0777d6d 100644 --- a/desktop_version/lang/it/meta.xml +++ b/desktop_version/lang/it/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/ja/meta.xml b/desktop_version/lang/ja/meta.xml index 7750623c..ee824995 100644 --- a/desktop_version/lang/ja/meta.xml +++ b/desktop_version/lang/ja/meta.xml @@ -27,6 +27,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/ko/meta.xml b/desktop_version/lang/ko/meta.xml index 98e05db3..f18ef7a3 100644 --- a/desktop_version/lang/ko/meta.xml +++ b/desktop_version/lang/ko/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/nl/meta.xml b/desktop_version/lang/nl/meta.xml index 9891880b..529d1307 100644 --- a/desktop_version/lang/nl/meta.xml +++ b/desktop_version/lang/nl/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/pl/meta.xml b/desktop_version/lang/pl/meta.xml index d9d26e31..ae15300a 100644 --- a/desktop_version/lang/pl/meta.xml +++ b/desktop_version/lang/pl/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/pt_BR/meta.xml b/desktop_version/lang/pt_BR/meta.xml index 79e1f05d..bb1fe5b3 100644 --- a/desktop_version/lang/pt_BR/meta.xml +++ b/desktop_version/lang/pt_BR/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/pt_PT/meta.xml b/desktop_version/lang/pt_PT/meta.xml index 7277830d..41d2532a 100644 --- a/desktop_version/lang/pt_PT/meta.xml +++ b/desktop_version/lang/pt_PT/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/ru/meta.xml b/desktop_version/lang/ru/meta.xml index 3d2997c2..b26d67a4 100644 --- a/desktop_version/lang/ru/meta.xml +++ b/desktop_version/lang/ru/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/szl/meta.xml b/desktop_version/lang/szl/meta.xml index d10023f4..23366352 100644 --- a/desktop_version/lang/szl/meta.xml +++ b/desktop_version/lang/szl/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/tr/meta.xml b/desktop_version/lang/tr/meta.xml index 8035f4b7..6daf3fc4 100644 --- a/desktop_version/lang/tr/meta.xml +++ b/desktop_version/lang/tr/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/uk/meta.xml b/desktop_version/lang/uk/meta.xml index a52cc81a..c0de4109 100644 --- a/desktop_version/lang/uk/meta.xml +++ b/desktop_version/lang/uk/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/zh/meta.xml b/desktop_version/lang/zh/meta.xml index 99c0d354..3e405654 100644 --- a/desktop_version/lang/zh/meta.xml +++ b/desktop_version/lang/zh/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/lang/zh_TW/meta.xml b/desktop_version/lang/zh_TW/meta.xml index 7b6cd367..d27d51fb 100644 --- a/desktop_version/lang/zh_TW/meta.xml +++ b/desktop_version/lang/zh_TW/meta.xml @@ -26,6 +26,9 @@ 0 + + 0 + [ {label} ] [{label}] diff --git a/desktop_version/src/Localization.h b/desktop_version/src/Localization.h index 1f5c3bbf..defa7d93 100644 --- a/desktop_version/src/Localization.h +++ b/desktop_version/src/Localization.h @@ -27,6 +27,7 @@ struct LangMeta bool toupper; // = true; enable automatic full-caps for menu options bool toupper_i_dot; // = false; enable Turkish i mapping when uppercasing bool toupper_lower_escape_char; // = false; enable ~ to mark lowercase letters for uppercasing + bool rtl; // = false; enable for RTL languages like Arabic or Hebrew std::string menu_select; std::string menu_select_tight; uint8_t font_idx; diff --git a/desktop_version/src/LocalizationMaint.cpp b/desktop_version/src/LocalizationMaint.cpp index 35f54761..926ba86b 100644 --- a/desktop_version/src/LocalizationMaint.cpp +++ b/desktop_version/src/LocalizationMaint.cpp @@ -96,6 +96,8 @@ static void sync_lang_file(const std::string& langcode) pElem->SetText((int) langmeta.toupper_i_dot); else if (SDL_strcmp(pKey, "toupper_lower_escape_char") == 0) pElem->SetText((int) langmeta.toupper_lower_escape_char); + else if (SDL_strcmp(pKey, "rtl") == 0) + pElem->SetText((int) langmeta.rtl); else if (SDL_strcmp(pKey, "menu_select") == 0) pElem->SetText(langmeta.menu_select.c_str()); else if (SDL_strcmp(pKey, "menu_select_tight") == 0) diff --git a/desktop_version/src/LocalizationStorage.cpp b/desktop_version/src/LocalizationStorage.cpp index 08bbc2b1..57783b73 100644 --- a/desktop_version/src/LocalizationStorage.cpp +++ b/desktop_version/src/LocalizationStorage.cpp @@ -67,6 +67,7 @@ static void loadmeta(LangMeta& meta, const std::string& langcode = lang) meta.toupper = true; meta.toupper_i_dot = false; meta.toupper_lower_escape_char = false; + meta.rtl = false; meta.menu_select = "[ {label} ]"; meta.menu_select_tight = "[{label}]"; meta.font_idx = font::get_font_idx_8x8(); @@ -107,6 +108,8 @@ static void loadmeta(LangMeta& meta, const std::string& langcode = lang) meta.toupper_i_dot = help.Int(pText); else if (SDL_strcmp(pKey, "toupper_lower_escape_char") == 0) meta.toupper_lower_escape_char = help.Int(pText); + else if (SDL_strcmp(pKey, "rtl") == 0) + meta.rtl = help.Int(pText); else if (SDL_strcmp(pKey, "menu_select") == 0) meta.menu_select = std::string(pText); else if (SDL_strcmp(pKey, "menu_select_tight") == 0)