l10n: full interface translation (FR/RO/IT/ZH) + EN fallback hardening (#186)

This commit is contained in:
Ferywir
2026-06-09 09:28:59 +02:00
committed by GitHub
parent 695a4352e8
commit 5d366284e6
381 changed files with 7969 additions and 4761 deletions
+25 -15
View File
@@ -39,6 +39,10 @@ class Profile {
$this->updateProfile($post);
break;
case "p2":
$this->updatePreferences($post);
break;
case "p3":
$this->updateAccount($post);
break;
@@ -54,6 +58,27 @@ class Profile {
}
}
/**
* Preferences form (ft=p2): persist the per-user game language.
* Writes the existing `lang` column (matches struct.sql + Session seeding).
*/
private function updatePreferences($post) {
global $database, $session;
$allowed = ['en', 'fr', 'it', 'ro', 'zh'];
if (!empty($post['lang'])) {
$lang = strtolower(trim($post['lang']));
if (in_array($lang, $allowed, true)) {
$database->updateUserField($session->uid, "lang", $lang, 1);
$_SESSION['lang'] = $lang;
$session->userinfo['lang'] = $lang;
}
}
header("Location: spieler.php?s=2");
exit;
}
public function procSpecial($get) {
if (isset($get['e'])) {
switch ($get['e']) {
@@ -219,21 +244,6 @@ class Profile {
$form->addError("email", EMAIL_ERROR);
}
}
// Language change
if (!empty($post['sprache'])) {
// whitelist pune aici limbile pe care le ai în /lang/
$allowed = ['en','fr','it','ro','zh'];
$lang = strtolower(trim($post['sprache']));
if (in_array($lang, $allowed, true)) {
$database->updateUserField($session->uid, "language", $lang, 1);
// update sesiunea ca să se vadă imediat, fără relog
$_SESSION['lang'] = $lang;
$session->userinfo['language'] = $lang;
}
}
// Delete request cancel
if (!empty($post['del_pw']) && !empty($post['del'])) {