mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-02 16:49:05 +00:00
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:
+24
-13
@@ -85,10 +85,8 @@ static const std::vector<std::string> mainStrings = { "LANGUAGE", "SELECT_UNISTO
|
||||
static const std::vector<std::string> dirStrings = { "CHANGE_3DSX_PATH", "3DSX_IN_FOLDER", "CHANGE_NDS_PATH", "CHANGE_ARCHIVE_PATH", "CHANGE_SHORTCUT_PATH", "CHANGE_FIRM_PATH" };
|
||||
|
||||
/* Note: Украïнська is spelled using a latin i with dieresis to work in the system font */
|
||||
//static const std::vector<std::string> languages = { "Bruh", "Dansk", "Deutsch", "English", "Español", "Français", "Italiano", "Lietuvių", "Magyar", "Polski", "Português", "Português (Brasil)", "Русский", "Украïнська", "日本語" };
|
||||
//static const std::string langsTemp[] = { "br", "da", "de", "en", "es", "fr", "it", "lt", "hu", "pl", "pt", "pt-BR", "ru", "uk", "jp"};
|
||||
static const std::vector<std::string> languages = { "Bruh", "Deutsch", "English", "Español", "Français", "Italiano", "Magyar", "Polski", "Português", "Português (Brasil)", "Русский", "Украïнська", "日本語" };
|
||||
static const std::string langsTemp[] = { "br", "de", "en", "es", "fr", "it", "hu", "pl", "pt", "pt-BR", "ru", "uk", "jp"};
|
||||
static const std::vector<std::string> languages = { "Bruh", "Deutsch", "English", "Español", "Français", "Italiano", /* "Lietuvių", */ "Magyar", /* "Nederlands", */ "Polski", "Português", "Português (Brasil)", "Русский", "Украïнська", /* "עברית", */ "中文 (简体)", "中文 (繁體)", "日本語", /* "한국어" */ };
|
||||
static const std::string langsTemp[] = { "br", "de", "en", "es", "fr", "it", /* "lt", */ "hu", /* "nl", */ "pl", "pt", "pt-BR", "ru", "uk", /* "he", */ "zh-CN", "zh-TW", "jp", /* "ko" */ };
|
||||
|
||||
static const std::vector<std::string> ThemeNames = { "THEME_DEFAULT", "Stack" };
|
||||
|
||||
@@ -578,10 +576,14 @@ static void LanguageLogic(int &page, int &selection, int &sPos) {
|
||||
if (hDown & KEY_A) {
|
||||
const std::string l = langsTemp[selection];
|
||||
|
||||
/* Check if is "uk". */
|
||||
if (l == "uk") {
|
||||
if (access("sdmc:/3ds/Universal-Updater/font.bcfnt", F_OK) != 0) {
|
||||
ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/universal-updater.bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"));
|
||||
/* Check if language needs a custom font. */
|
||||
u8 region;
|
||||
CFGU_SecureInfoGetRegion(®ion);
|
||||
if (l == "uk" || (l == "zh-CN" && region != CFG_REGION_CHN) || (l == "zh-TW" && region != CFG_REGION_TWN)) {
|
||||
if (access("sdmc:/3ds/Universal-Updater/font.bcfnt", F_OK) != 0 || config->downloadedFont() != l) {
|
||||
ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/" + l + ".bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"), true);
|
||||
config->downloadedFont(l);
|
||||
Init::UnloadFont();
|
||||
}
|
||||
|
||||
config->customfont(true);
|
||||
@@ -601,10 +603,14 @@ static void LanguageLogic(int &page, int &selection, int &sPos) {
|
||||
if (i + sPos < (int)languages.size()) {
|
||||
const std::string l = langsTemp[i + sPos];
|
||||
|
||||
/* Check if is "uk". */
|
||||
if (l == "uk") {
|
||||
if (access("sdmc:/3ds/Universal-Updater/font.bcfnt", F_OK) != 0) {
|
||||
ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/universal-updater.bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"));
|
||||
/* Check if language needs a custom font. */
|
||||
u8 region;
|
||||
CFGU_SecureInfoGetRegion(®ion);
|
||||
if (l == "uk" || (l == "zh-CN" && region != CFG_REGION_CHN) || (l == "zh-TW" && region != CFG_REGION_TWN)) {
|
||||
if (access("sdmc:/3ds/Universal-Updater/font.bcfnt", F_OK) != 0 || config->downloadedFont() != l) {
|
||||
ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/" + l + ".bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"), true);
|
||||
config->downloadedFont(l);
|
||||
Init::UnloadFont();
|
||||
}
|
||||
|
||||
config->customfont(true);
|
||||
@@ -624,8 +630,13 @@ static void LanguageLogic(int &page, int &selection, int &sPos) {
|
||||
if (hDown & KEY_TOUCH) {
|
||||
if (touching(touch, langButtons[6])) {
|
||||
/* Download Font. */
|
||||
ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/universal-updater.bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"), true);
|
||||
std::string l = config->language();
|
||||
if(l != "uk" && l != "zh-CN" && l != "zh-TW")
|
||||
l = "uk";
|
||||
ScriptUtils::downloadFile("https://github.com/Universal-Team/extras/raw/master/files/" + l + ".bcfnt", "sdmc:/3ds/Universal-Updater/font.bcfnt", Lang::get("DOWNLOADING_COMPATIBLE_FONT"), true);
|
||||
config->downloadedFont(l);
|
||||
config->customfont(true);
|
||||
Init::UnloadFont();
|
||||
Init::LoadFont();
|
||||
}
|
||||
}
|
||||
|
||||
+37
-30
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user