1
0
Fork 0
mirror of https://github.com/HamletDuFromage/aio-switch-updater.git synced 2024-12-28 02:16:03 +00:00

clean up language changing code

This commit is contained in:
flb 2022-04-21 01:58:50 +02:00
parent 33120ab7df
commit 8e594aa80e
7 changed files with 38 additions and 133 deletions

View file

@ -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 LOCALISATION_FILE[] = "romds:/i18n/{}/menus.json";
constexpr const int LISTITEM_HEIGHT = 50;
enum class contentType

View file

@ -161,7 +161,6 @@
"language": "Sprache der Anwendung ändern"
},
"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).",
"overwrite": " Möchtest du die folgende Datei ü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.",
"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."
},
"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)"
}
}
}

View file

@ -199,26 +199,5 @@
"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.",
"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)"
}
}
}

View file

@ -185,7 +185,7 @@
"cant_fetch_deepsea": "Impossible de récupérer les paquets. Ouvrez une issue GitHub si le problème persiste.",
"build_your_deepsea": "Personnalisez l'installation de DeepSea en sélectionnant les paquets à inclure",
"getting_ams": "Installer Atmopshère",
"custom_packs_label": "\u25c6 Voici les paquets listés dans le fichier {}. Assurez-vous de la fiabilité de leur source car il ne bénéficient d'aucun support de la part d'AIO-Switch-Updater."
"custom_packs_label": "\u25c6 Voici les paquets listés dans le fichier {}. Assurez-vous de la fiabilité de leur source car il ne bénéficient d'aucun support de la part d'AIO-Switch-Updater."
},
"firmware": {
"launch_daybreak": "Voulez-vous lancer Daybreak pour installer la mise à jour système téléchargée\u00a0?"
@ -197,26 +197,5 @@
"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",
"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)"
}
}

View file

@ -198,26 +198,5 @@
"insufficient_storage": "この操作を実行するのに十分な空き容量がSDカードにありません。",
"error_message": "{}\nしばらくしてからもう一度お試しください。問題が解決しない場合は、GitHubで問題を開きます",
"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)"
}
}

View file

@ -195,26 +195,5 @@
"insufficient_storage": "記憶卡沒有足夠的可用空間來執行此操作",
"error_message": "{}\n請稍後再重新執行一次。如果問題持續發生請使用GitHub提出問題來進行回報",
"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)"
}
}
}

View file

@ -139,22 +139,29 @@ ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payload
language = new brls::ListItem("menus/tools/language"_i18n);
language->getClickEvent()->subscribe([](brls::View* view) {
std::vector<std::pair<std::string, std::string>> languages{
std::make_pair("menus/language/en-US"_i18n, "en-US"),
std::make_pair("menus/language/ja"_i18n, "ja"),
std::make_pair("menus/language/fr"_i18n, "fr"),
std::make_pair("menus/language/de"_i18n, "de"),
std::make_pair("menus/language/it"_i18n, "it"),
std::make_pair("menus/language/es"_i18n, "es"),
std::make_pair("menus/language/pl"_i18n, "pl"),
std::make_pair("menus/language/zh-CN"_i18n, "zh-CN"),
std::make_pair("menus/language/zh-TW"_i18n, "zh-TW"),
std::make_pair("menus/language/es-419"_i18n, "es-419"),
std::make_pair("menus/language/zh-Hant"_i18n, "zh-Hant"),
std::make_pair("menus/language/zh-Hans"_i18n, "zh-Hans")};
std::make_pair("American English ({})", "en-US"),
std::make_pair("日本語 ({})", "ja"),
std::make_pair("Français ({})", "fr"),
std::make_pair("Deutsch ({})", "de"),
std::make_pair("Italiano ({})", "it"),
std::make_pair("Español ({})", "es"),
std::make_pair("Português ({})", "pt"),
std::make_pair("Nederlands ({})", "nl"),
std::make_pair("Русский ({})", "ru"),
std::make_pair("한국어 ({})", "ko"),
std::make_pair("Polski ({})", "pl"),
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::List* list = new brls::List();
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, [] {
std::filesystem::remove(LANGUAGE_JSON);
brls::Application::quit();
@ -162,16 +169,18 @@ ToolsTab::ToolsTab(const std::string& tag, const nlohmann::ordered_json& payload
});
list->addView(listItem);
for (auto& language : languages) {
listItem = new brls::ListItem(language.first);
listItem->registerAction("menus/tools/language"_i18n, brls::Key::A, [language] {
json updatedLanguage = json::object();
updatedLanguage["language"] = language.second;
std::ofstream out(LANGUAGE_JSON);
out << updatedLanguage.dump();
brls::Application::quit();
return true;
});
list->addView(listItem);
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] {
json updatedLanguage = json::object();
updatedLanguage["language"] = language.second;
std::ofstream out(LANGUAGE_JSON);
out << updatedLanguage.dump();
brls::Application::quit();
return true;
});
list->addView(listItem);
}
}
appView->setContentView(list);
brls::PopupFrame::open("menus/tools/language"_i18n, appView, "", "");