mirror of
https://github.com/HamletDuFromage/aio-switch-updater.git
synced 2024-12-29 10:56:01 +00:00
clean up language changing code
This commit is contained in:
parent
33120ab7df
commit
8e594aa80e
7 changed files with 38 additions and 133 deletions
|
@ -104,6 +104,8 @@ constexpr const char DAYBREAK_PATH[] = "/switch/daybreak.nro";
|
||||||
|
|
||||||
constexpr const char HIDDEN_AIO_FILE[] = "/config/aio-switch-updater/.aio-switch-updater";
|
constexpr const char HIDDEN_AIO_FILE[] = "/config/aio-switch-updater/.aio-switch-updater";
|
||||||
|
|
||||||
|
constexpr const char LOCALISATION_FILE[] = "romds:/i18n/{}/menus.json";
|
||||||
|
|
||||||
constexpr const int LISTITEM_HEIGHT = 50;
|
constexpr const int LISTITEM_HEIGHT = 50;
|
||||||
|
|
||||||
enum class contentType
|
enum class contentType
|
||||||
|
|
|
@ -161,7 +161,6 @@
|
||||||
"language": "Sprache der Anwendung ändern"
|
"language": "Sprache der Anwendung ändern"
|
||||||
},
|
},
|
||||||
"utils": {
|
"utils": {
|
||||||
|
|
||||||
"fw_warning": "Wegen der Größe der Firmwarearchive werden Downloads im Applet Mode nicht unterstützt. Bitte öffne die App mit vollem RAM Zugriff (Title Redirection).",
|
"fw_warning": "Wegen der Größe der Firmwarearchive werden Downloads im Applet Mode nicht unterstützt. Bitte öffne die App mit vollem RAM Zugriff (Title Redirection).",
|
||||||
"overwrite": " Möchtest du die folgende Datei überschreiben: ",
|
"overwrite": " Möchtest du die folgende Datei überschreiben: ",
|
||||||
"overwrite_inis": "Möchtest du die vorhandene .ini Konfigurationsdateien überschreiben?",
|
"overwrite_inis": "Möchtest du die vorhandene .ini Konfigurationsdateien überschreiben?",
|
||||||
|
@ -198,26 +197,5 @@
|
||||||
"insufficient_storage": "Auf der SD-Karte ist nicht genügend Speicherplatz vorhanden, um diesen Vorgang durchzuführen.",
|
"insufficient_storage": "Auf der SD-Karte ist nicht genügend Speicherplatz vorhanden, um diesen Vorgang durchzuführen.",
|
||||||
"error_message": "{}\\nBitte versuche es in Kürze erneut. Wenn das Problem weiterhin besteht, öffne ein Issue auf GitHub",
|
"error_message": "{}\\nBitte versuche es in Kürze erneut. Wenn das Problem weiterhin besteht, öffne ein Issue auf GitHub",
|
||||||
"mariko_payload_missing": "Um Atmosphère auf gepatchten Switches zu aktualisieren, muss der Payload \"payload.bin\" genannt werden und sollte sich im Root-Verzeichnis der SD-Karte befinden."
|
"mariko_payload_missing": "Um Atmosphère auf gepatchten Switches zu aktualisieren, muss der Payload \"payload.bin\" genannt werden und sollte sich im Root-Verzeichnis der SD-Karte befinden."
|
||||||
},
|
|
||||||
"language": {
|
|
||||||
"system_default": "Systemvoreinstellung",
|
|
||||||
"en-US": "American English (en-US)",
|
|
||||||
"ja": "日本語 (ja)",
|
|
||||||
"fr": "Français (fr)",
|
|
||||||
"de": "Deutsch (de)",
|
|
||||||
"it": "Italiano (it)",
|
|
||||||
"es": "Español (es)",
|
|
||||||
"zh-CN": "简体中文 (zh-CN)",
|
|
||||||
"ko": "한국어 (ko)",
|
|
||||||
"nl": "Nederlands (nl)",
|
|
||||||
"pt": "Português (pt)",
|
|
||||||
"ru": "Русский (ru)",
|
|
||||||
"pl": "Polski (pl)",
|
|
||||||
"zh-TW": "繁體中文 (zh-TW)",
|
|
||||||
"en-GB": "English (Great Britain) (en-GB)",
|
|
||||||
"fr-CA": "Français (Canada) (fr-CA)",
|
|
||||||
"es-419": "Español (Latinoamérica) (es-419)",
|
|
||||||
"zh-Hant": "Traditionelles Chinesisch (zh-Hant)",
|
|
||||||
"zh-Hans": "Vereinfachtes Chinesisch (zh-Hans)"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -199,26 +199,5 @@
|
||||||
"insufficient_storage": "There isn't enough space available on your SD card to perform this operation.",
|
"insufficient_storage": "There isn't enough space available on your SD card to perform this operation.",
|
||||||
"error_message": "{}\nPlease try again in a little while. If the problem persists, open an issue on GitHub.",
|
"error_message": "{}\nPlease try again in a little while. If the problem persists, open an issue on GitHub.",
|
||||||
"mariko_payload_missing": "In order to update Atmosphère on patched Switches, your payload needs to be named \"payload.bin\" and should be at the root of your SD card."
|
"mariko_payload_missing": "In order to update Atmosphère on patched Switches, your payload needs to be named \"payload.bin\" and should be at the root of your SD card."
|
||||||
},
|
|
||||||
"language": {
|
|
||||||
"system_default": "System default",
|
|
||||||
"en-US": "American English (en-US)",
|
|
||||||
"ja": "日本語 (ja)",
|
|
||||||
"fr": "Français (fr)",
|
|
||||||
"de": "Deutsch (de)",
|
|
||||||
"it": "Italiano (it)",
|
|
||||||
"es": "Español (es)",
|
|
||||||
"zh-CN": "简体中文 (zh-CN)",
|
|
||||||
"ko": "한국어 (ko)",
|
|
||||||
"nl": "Nederlands (nl)",
|
|
||||||
"pt": "Português (pt)",
|
|
||||||
"ru": "Русский (ru)",
|
|
||||||
"pl": "Polski (pl)",
|
|
||||||
"zh-TW": "繁體中文 (zh-TW)",
|
|
||||||
"en-GB": "English (Great Britain) (en-GB)",
|
|
||||||
"fr-CA": "Français (Canada) (fr-CA)",
|
|
||||||
"es-419": "Español (Latinoamérica) (es-419)",
|
|
||||||
"zh-Hant": "Traditional Chinese (zh-Hant)",
|
|
||||||
"zh-Hans": "Simplified Chinese (zh-Hans)"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -197,26 +197,5 @@
|
||||||
"insufficient_storage": "Il n'y a pas assez d'espace disponible sur la carte SD pour effectuer cette opération.",
|
"insufficient_storage": "Il n'y a pas assez d'espace disponible sur la carte SD pour effectuer cette opération.",
|
||||||
"error_message": "{}\nVeuillez réessayer un peu plus tard. Si le problème persiste, ouvrez une issue sur GitHub",
|
"error_message": "{}\nVeuillez réessayer un peu plus tard. Si le problème persiste, ouvrez une issue sur GitHub",
|
||||||
"mariko_payload_missing": "Pour mettre à jour Atmopshère sur une Switch patchée, le payload doit être nommé \"payload.bin\" et être placé à la racine de votre carte SD."
|
"mariko_payload_missing": "Pour mettre à jour Atmopshère sur une Switch patchée, le payload doit être nommé \"payload.bin\" et être placé à la racine de votre carte SD."
|
||||||
},
|
|
||||||
"language": {
|
|
||||||
"system_default": "Langue du système",
|
|
||||||
"en-US": "American English (en-US)",
|
|
||||||
"ja": "日本語 (ja)",
|
|
||||||
"fr": "Français (fr)",
|
|
||||||
"de": "Deutsch (de)",
|
|
||||||
"it": "Italiano (it)",
|
|
||||||
"es": "Español (es)",
|
|
||||||
"zh-CN": "简体中文 (zh-CN)",
|
|
||||||
"ko": "한국어 (ko)",
|
|
||||||
"nl": "Nederlands (nl)",
|
|
||||||
"pt": "Português (pt)",
|
|
||||||
"ru": "Русский (ru)",
|
|
||||||
"pl": "Polski (pl)",
|
|
||||||
"zh-TW": "繁體中文 (zh-TW)",
|
|
||||||
"en-GB": "English (Great Britain) (en-GB)",
|
|
||||||
"fr-CA": "Français (Canada) (fr-CA)",
|
|
||||||
"es-419": "Español (Latinoamérica) (es-419)",
|
|
||||||
"zh-Hant": "Chinois traditionnel (zh-Hant)",
|
|
||||||
"zh-Hans": "Chinois simplifié (zh-Hans)"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -198,26 +198,5 @@
|
||||||
"insufficient_storage": "この操作を実行するのに十分な空き容量がSDカードにありません。",
|
"insufficient_storage": "この操作を実行するのに十分な空き容量がSDカードにありません。",
|
||||||
"error_message": "{}\nしばらくしてからもう一度お試しください。問題が解決しない場合は、GitHubで問題を開きます",
|
"error_message": "{}\nしばらくしてからもう一度お試しください。問題が解決しない場合は、GitHubで問題を開きます",
|
||||||
"mariko_payload_missing": "対策機の本体でAtmosphèreを更新するには、ペイロードに \"payload.bin\" という名前を付け、SDカードのルートに配置する必要があります。"
|
"mariko_payload_missing": "対策機の本体でAtmosphèreを更新するには、ペイロードに \"payload.bin\" という名前を付け、SDカードのルートに配置する必要があります。"
|
||||||
},
|
|
||||||
"language": {
|
|
||||||
"system_default": "システムのデフォルト",
|
|
||||||
"en-US": "American English (en-US)",
|
|
||||||
"ja": "日本語 (ja)",
|
|
||||||
"fr": "Français (fr)",
|
|
||||||
"de": "Deutsch (de)",
|
|
||||||
"it": "Italiano (it)",
|
|
||||||
"es": "Español (es)",
|
|
||||||
"zh-CN": "简体中文 (zh-CN)",
|
|
||||||
"ko": "한국어 (ko)",
|
|
||||||
"nl": "Nederlands (nl)",
|
|
||||||
"pt": "Português (pt)",
|
|
||||||
"ru": "Русский (ru)",
|
|
||||||
"pl": "Polski (pl)",
|
|
||||||
"zh-TW": "繁體中文 (zh-TW)",
|
|
||||||
"en-GB": "English (Great Britain) (en-GB)",
|
|
||||||
"fr-CA": "Français (Canada) (fr-CA)",
|
|
||||||
"es-419": "Español (Latinoamérica) (es-419)",
|
|
||||||
"zh-Hant": "Traditional Chinese (zh-Hant)",
|
|
||||||
"zh-Hans": "Simplified Chinese (zh-Hans)"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -195,26 +195,5 @@
|
||||||
"insufficient_storage": "記憶卡沒有足夠的可用空間來執行此操作",
|
"insufficient_storage": "記憶卡沒有足夠的可用空間來執行此操作",
|
||||||
"error_message": "{}\n請稍後再重新執行一次。如果問題持續發生,請使用GitHub提出問題來進行回報",
|
"error_message": "{}\n請稍後再重新執行一次。如果問題持續發生,請使用GitHub提出問題來進行回報",
|
||||||
"mariko_payload_missing": "在Mariko Switch上進行更新大氣層之前,需要將大氣層注入引導的檔案命名為\"payload.bin\",並置於記憶卡的根目錄下。"
|
"mariko_payload_missing": "在Mariko Switch上進行更新大氣層之前,需要將大氣層注入引導的檔案命名為\"payload.bin\",並置於記憶卡的根目錄下。"
|
||||||
},
|
|
||||||
"language": {
|
|
||||||
"system_default": "系統預設",
|
|
||||||
"en-US": "American English (en-US)",
|
|
||||||
"ja": "日本語 (ja)",
|
|
||||||
"fr": "Français (fr)",
|
|
||||||
"de": "Deutsch (de)",
|
|
||||||
"it": "Italiano (it)",
|
|
||||||
"es": "Español (es)",
|
|
||||||
"zh-CN": "简体中文 (zh-CN)",
|
|
||||||
"ko": "한국어 (ko)",
|
|
||||||
"nl": "Nederlands (nl)",
|
|
||||||
"pt": "Português (pt)",
|
|
||||||
"ru": "Русский (ru)",
|
|
||||||
"pl": "Polski (pl)",
|
|
||||||
"zh-TW": "繁體中文 (zh-TW)",
|
|
||||||
"en-GB": "English (Great Britain) (en-GB)",
|
|
||||||
"fr-CA": "Français (Canada) (fr-CA)",
|
|
||||||
"es-419": "Español (Latinoamérica) (es-419)",
|
|
||||||
"zh-Hant": "繁體中文 (zh-Hant)",
|
|
||||||
"zh-Hans": "簡體中文 (zh-Hans)"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -139,22 +139,29 @@ ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payload
|
||||||
language = new brls::ListItem("menus/tools/language"_i18n);
|
language = new brls::ListItem("menus/tools/language"_i18n);
|
||||||
language->getClickEvent()->subscribe([](brls::View* view) {
|
language->getClickEvent()->subscribe([](brls::View* view) {
|
||||||
std::vector<std::pair<std::string, std::string>> languages{
|
std::vector<std::pair<std::string, std::string>> languages{
|
||||||
std::make_pair("menus/language/en-US"_i18n, "en-US"),
|
std::make_pair("American English ({})", "en-US"),
|
||||||
std::make_pair("menus/language/ja"_i18n, "ja"),
|
std::make_pair("日本語 ({})", "ja"),
|
||||||
std::make_pair("menus/language/fr"_i18n, "fr"),
|
std::make_pair("Français ({})", "fr"),
|
||||||
std::make_pair("menus/language/de"_i18n, "de"),
|
std::make_pair("Deutsch ({})", "de"),
|
||||||
std::make_pair("menus/language/it"_i18n, "it"),
|
std::make_pair("Italiano ({})", "it"),
|
||||||
std::make_pair("menus/language/es"_i18n, "es"),
|
std::make_pair("Español ({})", "es"),
|
||||||
std::make_pair("menus/language/pl"_i18n, "pl"),
|
std::make_pair("Português ({})", "pt"),
|
||||||
std::make_pair("menus/language/zh-CN"_i18n, "zh-CN"),
|
std::make_pair("Nederlands ({})", "nl"),
|
||||||
std::make_pair("menus/language/zh-TW"_i18n, "zh-TW"),
|
std::make_pair("Русский ({})", "ru"),
|
||||||
std::make_pair("menus/language/es-419"_i18n, "es-419"),
|
std::make_pair("한국어 ({})", "ko"),
|
||||||
std::make_pair("menus/language/zh-Hant"_i18n, "zh-Hant"),
|
std::make_pair("Polski ({})", "pl"),
|
||||||
std::make_pair("menus/language/zh-Hans"_i18n, "zh-Hans")};
|
std::make_pair("简体中文 ({})", "zh-CN"),
|
||||||
|
std::make_pair("繁體中文 ({})", "zh-TW"),
|
||||||
|
std::make_pair("English (Great Britain) ({})", "en-GB"),
|
||||||
|
std::make_pair("Français (Canada) ({})", "fr-CA"),
|
||||||
|
std::make_pair("Español (Latinoamérica) ({})", "es-419"),
|
||||||
|
std::make_pair("Português brasileiro ({})", "pt-BR"),
|
||||||
|
std::make_pair("Traditional Chinese ({})", "zh-Hant"),
|
||||||
|
std::make_pair("Simplified Chinese ({})", "zh-Hans")};
|
||||||
brls::AppletFrame* appView = new brls::AppletFrame(true, true);
|
brls::AppletFrame* appView = new brls::AppletFrame(true, true);
|
||||||
brls::List* list = new brls::List();
|
brls::List* list = new brls::List();
|
||||||
brls::ListItem* listItem;
|
brls::ListItem* listItem;
|
||||||
listItem = new brls::ListItem(fmt::format("{} ({})", "menus/language/system_default"_i18n, i18n::getCurrentLocale()));
|
listItem = new brls::ListItem(fmt::format("System Default ({})", i18n::getCurrentLocale()));
|
||||||
listItem->registerAction("menus/tools/language"_i18n, brls::Key::A, [] {
|
listItem->registerAction("menus/tools/language"_i18n, brls::Key::A, [] {
|
||||||
std::filesystem::remove(LANGUAGE_JSON);
|
std::filesystem::remove(LANGUAGE_JSON);
|
||||||
brls::Application::quit();
|
brls::Application::quit();
|
||||||
|
@ -162,7 +169,8 @@ ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payload
|
||||||
});
|
});
|
||||||
list->addView(listItem);
|
list->addView(listItem);
|
||||||
for (auto& language : languages) {
|
for (auto& language : languages) {
|
||||||
listItem = new brls::ListItem(language.first);
|
if (std::filesystem::exists(fmt::format(LOCALISATION_FILE, language.second))) {
|
||||||
|
listItem = new brls::ListItem(fmt::format(language.first, language.second));
|
||||||
listItem->registerAction("menus/tools/language"_i18n, brls::Key::A, [language] {
|
listItem->registerAction("menus/tools/language"_i18n, brls::Key::A, [language] {
|
||||||
json updatedLanguage = json::object();
|
json updatedLanguage = json::object();
|
||||||
updatedLanguage["language"] = language.second;
|
updatedLanguage["language"] = language.second;
|
||||||
|
@ -173,6 +181,7 @@ ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payload
|
||||||
});
|
});
|
||||||
list->addView(listItem);
|
list->addView(listItem);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
appView->setContentView(list);
|
appView->setContentView(list);
|
||||||
brls::PopupFrame::open("menus/tools/language"_i18n, appView, "", "");
|
brls::PopupFrame::open("menus/tools/language"_i18n, appView, "", "");
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue