feat: begin working on localisation

This commit is contained in:
frosty
2026-04-01 00:37:15 +03:00
parent 335b6f4683
commit c41ab84738
16 changed files with 275 additions and 63 deletions

View File

@@ -4,12 +4,15 @@
int settings_save_handler(UrlParams *params) {
const char *theme = "";
const char *locale = "";
const char *query = "";
if (params) {
for (int i = 0; i < params->count; i++) {
if (strcmp(params->params[i].key, "theme") == 0) {
theme = params->params[i].value;
} else if (strcmp(params->params[i].key, "locale") == 0) {
locale = params->params[i].value;
} else if (strcmp(params->params[i].key, "q") == 0) {
query = params->params[i].value;
}
@@ -19,6 +22,9 @@ int settings_save_handler(UrlParams *params) {
if (strlen(theme) > 0) {
set_cookie("theme", theme, "Fri, 31 Dec 2038 23:59:59 GMT", "/", false, false);
}
if (strlen(locale) > 0) {
set_cookie("locale", locale, "Fri, 31 Dec 2038 23:59:59 GMT", "/", false, false);
}
char redirect_url[512];
snprintf(redirect_url, sizeof(redirect_url), "/settings?q=%s", query);