mirror of
https://github.com/DarkStore-3DS/DarkStore.git
synced 2026-07-06 00:38:59 +00:00
Set system language to the app on first launch (#42)
* add language on first launch * add language on first launch Editing the hpp aswell
This commit is contained in:
@@ -38,6 +38,7 @@ public:
|
|||||||
void save();
|
void save();
|
||||||
void initialize();
|
void initialize();
|
||||||
void addMissingThings();
|
void addMissingThings();
|
||||||
|
void sysLang();
|
||||||
|
|
||||||
// Bar Color.
|
// Bar Color.
|
||||||
u32 barColor() { return this->v_barColor; }
|
u32 barColor() { return this->v_barColor; }
|
||||||
@@ -157,4 +158,4 @@ private:
|
|||||||
std::string v_3dsx_install_path, v_nds_install_path, v_archive_path;
|
std::string v_3dsx_install_path, v_nds_install_path, v_archive_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+49
-3
@@ -40,6 +40,52 @@ void Config::addMissingThings() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Detects system language and is used later to set app language to system language
|
||||||
|
void Config::sysLang() {
|
||||||
|
u8 language = 0;
|
||||||
|
|
||||||
|
CFGU_GetSystemLanguage(&language);
|
||||||
|
switch(language) {
|
||||||
|
case 0:
|
||||||
|
this->language("jp");
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
this->language("en");
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
this->language("fr");
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
this->language("de");
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
this->language("it");
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
this->language("es");
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
this->language("en"); //Simplified chinese, not translated
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
this->language("en"); //Korean, not translated
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
this->language("nl");
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
this->language("pt");
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
this->language("ru");
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
this->language("en"); //traditional chinese, not translated
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// In case it doesn't exist.
|
// In case it doesn't exist.
|
||||||
void Config::initialize() {
|
void Config::initialize() {
|
||||||
// Create through fopen "Write".
|
// Create through fopen "Write".
|
||||||
@@ -70,7 +116,7 @@ void Config::initialize() {
|
|||||||
this->setInt("KEY_DELAY", 5);
|
this->setInt("KEY_DELAY", 5);
|
||||||
this->setBool("SCREEN_FADE", false);
|
this->setBool("SCREEN_FADE", false);
|
||||||
this->setBool("PROGRESS_DISPLAY", true);
|
this->setBool("PROGRESS_DISPLAY", true);
|
||||||
this->setString("LANGUAGE", "en");
|
this->sysLang();
|
||||||
this->setBool("FIRST_STARTUP", true);
|
this->setBool("FIRST_STARTUP", true);
|
||||||
this->setBool("USE_SCRIPT_COLORS", true);
|
this->setBool("USE_SCRIPT_COLORS", true);
|
||||||
this->setBool("SHOW_SPEED", false);
|
this->setBool("SHOW_SPEED", false);
|
||||||
@@ -250,7 +296,7 @@ Config::Config() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this->json.contains("LANGUAGE") || this->json.at("LANGUAGE").is_number()) {
|
if (!this->json.contains("LANGUAGE") || this->json.at("LANGUAGE").is_number()) {
|
||||||
this->language("en");
|
this->sysLang();
|
||||||
this->initialChanges = true;
|
this->initialChanges = true;
|
||||||
} else {
|
} else {
|
||||||
this->language(this->getString("LANGUAGE"));
|
this->language(this->getString("LANGUAGE"));
|
||||||
@@ -378,4 +424,4 @@ std::string Config::getString(const std::string &key) {
|
|||||||
}
|
}
|
||||||
void Config::setString(const std::string &key, const std::string &v) {
|
void Config::setString(const std::string &key, const std::string &v) {
|
||||||
this->json[key] = v;
|
this->json[key] = v;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user