Add Chinese and fix some bugs (see desc)

- Fix 3dsx in folder setting not being saved on exit
- Fix font download on language selection not having a progress bar
- Also update translations as to have something to test Chinese with
This commit is contained in:
Pk11
2021-03-19 05:49:53 -05:00
parent cab050e4d9
commit 36b5d9c528
7 changed files with 385 additions and 77 deletions
+37 -30
View File
@@ -27,6 +27,7 @@
#include "common.hpp"
#include "config.hpp"
#include "json.hpp"
#include "scriptUtils.hpp"
#include <string>
#include <unistd.h>
@@ -39,59 +40,55 @@ void Config::sysLang() {
switch(language) {
case 0:
this->language("jp");
this->language("jp"); // Japanese
break;
case 1:
this->language("en");
this->language("en"); // English
break;
case 2:
this->language("fr");
this->language("fr"); // French
break;
case 3:
this->language("de");
this->language("de"); // German
break;
case 4:
this->language("it");
this->language("it"); // Italian
break;
case 5:
this->language("es");
break;
/*
case 6:
this->language("sc"); //simplified chinese
break;
case 7:
this->language("kr") //korean
break;
*/
case 8:
this->language("nl");
this->language("es"); // Spanish
break;
case 6:
this->language("zh-CN"); // Chinese (Simplified)
break;
// case 7:
// this->language("ko"); // Korean
// break;
// case 8:
// this->language("nl"); // Dutch
// break;
case 9:
this->language("pt");
this->language("pt"); // Portuguese
break;
case 10:
this->language("ru");
this->language("ru"); // Russian
break;
/*
case 11:
this->language("tc") //traditional chinese
this->language("zh-TW"); // Chinese (Traditional)
break;
*/
default:
this->language("en"); //for Simplified chinese (6), korean (7) and traditional chinese (11), which are not translated. also in case something goes wrong
this->language("en"); // Fall back to English if missing
break;
}
}
@@ -121,13 +118,11 @@ Config::Config() {
/* Let us create a new one. */
if (!this->json.contains("Version")) this->initialize();
if (!this->json.contains("Language")) this->sysLang();
else this->language(this->getString("Language"));
if (this->json.contains("LastStore")) this->lastStore(this->getString("LastStore"));
if (this->json.contains("List")) this->list(this->getBool("List"));
if (this->json.contains("AutoUpdate")) this->autoupdate(this->getBool("AutoUpdate"));
if (this->json.contains("_3DSX_Path")) this->_3dsxPath(this->getString("_3DSX_Path"));
if (this->json.contains("_3DSX_InFolder")) this->_3dsxInFolder(this->getBool("_3DSX_InFolder"));
if (this->json.contains("NDS_Path")) this->ndsPath(this->getString("NDS_Path"));
if (this->json.contains("Archive_Path")) this->archPath(this->getString("Archive_Path"));
if (this->json.contains("Firm_Path")) this->firmPath(this->getString("Firm_Path"));
@@ -135,11 +130,21 @@ Config::Config() {
if (this->json.contains("UpdateCheck")) this->updatecheck(this->getBool("UpdateCheck"));
if (this->json.contains("UseBG")) this->usebg(this->getBool("UseBG"));
if (this->json.contains("CustomFont")) this->customfont(this->getBool("CustomFont"));
if (this->json.contains("DownloadedFont")) this->downloadedFont(this->getString("DownloadedFont"));
if (this->json.contains("Shortcut_Path")) this->shortcut(this->getString("Shortcut_Path"));
if (this->json.contains("Display_Changelog")) this->changelog(this->getBool("Display_Changelog"));
if (this->json.contains("Active_Theme")) this->theme(this->getInt("Active_Theme"));
if (this->json.contains("Prompt")) this->prompt(this->getBool("Prompt"));
if (!this->json.contains("Language")) {
this->sysLang();
if((this->language() == "zh-CN" || this->language() == "zh-TW") && (access("sdmc:/3ds/Universal-Updater/font.bcfnt", F_OK) != 0 || this->downloadedFont() != this->language())) {
ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/" + this->language() + ".bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", "Downloading compatible font...", true);
this->downloadedFont(this->language());
this->customfont(true);
}
} else this->language(this->getString("Language"));
this->changesMade = false; // No changes made yet.
}
@@ -155,6 +160,7 @@ void Config::save() {
this->setBool("List", this->list());
this->setBool("AutoUpdate", this->autoupdate());
this->setString("_3DSX_Path", this->_3dsxPath());
this->setBool("_3DSX_InFolder", this->_3dsxInFolder());
this->setString("NDS_Path", this->ndsPath());
this->setString("Archive_Path", this->archPath());
this->setString("Firm_Path", this->firmPath());
@@ -162,6 +168,7 @@ void Config::save() {
this->setBool("UpdateCheck", this->updatecheck());
this->setBool("UseBG", this->usebg());
this->setBool("CustomFont", this->customfont());
this->setString("DownloadedFont", this->downloadedFont());
this->setString("Shortcut_Path", this->shortcut());
this->setBool("Display_Changelog", this->changelog());
this->setInt("Active_Theme", this->theme());