feat(i18n): add ui localization (#2279)

Co-authored-by: TheElixZammuto <6505622+TheElixZammuto@users.noreply.github.com>
This commit is contained in:
ReenigneArcher 2024-03-22 19:54:12 -04:00 committed by GitHub
commit 87774333f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 4446 additions and 719 deletions

View file

@ -550,6 +550,24 @@ namespace confighttp {
}
}
void
getLocale(resp_https_t response, req_https_t request) {
// we need to return the locale whether authenticated or not
print_req(request);
pt::ptree outputTree;
auto g = util::fail_guard([&]() {
std::ostringstream data;
pt::write_json(data, outputTree);
response->write(data.str());
});
outputTree.put("status", "true");
outputTree.put("locale", config::sunshine.locale);
}
void
saveConfig(resp_https_t response, req_https_t request) {
if (!authenticate(response, request)) return;
@ -743,6 +761,7 @@ namespace confighttp {
server.resource["^/api/apps$"]["POST"] = saveApp;
server.resource["^/api/config$"]["GET"] = getConfig;
server.resource["^/api/config$"]["POST"] = saveConfig;
server.resource["^/api/configLocale$"]["GET"] = getLocale;
server.resource["^/api/restart$"]["POST"] = restart;
server.resource["^/api/password$"]["POST"] = savePassword;
server.resource["^/api/apps/([0-9]+)$"]["DELETE"] = deleteApp;