Files
DarkStore/source/lang/lang.cpp
T
StackZ 09be8e0b94 Switch over to Universal-Core. (#18)
* Don't build here.

* WIP: Switch to Universal-Core.

* Update Submodule repo & azure-pipelines.
2020-02-08 06:20:50 +01:00

26 lines
681 B
C++

#include "config.hpp"
#include "lang.hpp"
#include <stdio.h>
nlohmann::json appJson;
std::string Lang::get(const std::string &key) {
if(!appJson.contains(key)) {
return "MISSING: " + key;
}
return appJson.at(key).get_ref<const std::string&>();
}
std::string langs[] = {"br", "de", "en", "es", "fr", "it", "lt", "pt", "ru", "jp"};
void Lang::load(int lang) {
FILE* values;
if (Config::LangPath == 1) {
values = fopen(("sdmc:/3ds/Universal-Updater/app.json"), "rt");
} else {
values = fopen(("romfs:/lang/"+langs[lang]+"/app.json").c_str(), "rt");
}
if(values) appJson = nlohmann::json::parse(values, nullptr, false);
fclose(values);
}