Added french translation and language switcher

This commit is contained in:
Renan LE CARO 2025-03-16 10:13:26 +01:00
parent 7555ed0ff1
commit 1b4d2fba81
7 changed files with 341 additions and 298 deletions

View file

@ -7,7 +7,7 @@ import {makeEmptyPerksMap, sumOfKeys} from "./game_utils";
import {baseCombo, decreaseCombo, resetCombo} from "./combo";
import "./sw_loader";
import {t} from "./i18n/i18n";
import {getCurrentLang, t} from "./i18n/i18n";
import {getSettingValue, setSettingValue} from "./settings";
const gameCanvas = document.getElementById("game") as HTMLCanvasElement;
@ -2637,6 +2637,34 @@ async function openSettingsPanel() {
},
});
actions.push({
text: t('main_menu.language'),
help: t('main_menu.language_help'),
async value() {
const pick = await asyncAlert({
title: t('main_menu.language'),
text: t('main_menu.language_help'),
actions: [
{
text: 'English',
value: 'en',
},
{
text: 'Français',
value: 'fr',
},
],
allowClose: true,
})
if (
pick && pick!==getCurrentLang()
) {
setSettingValue('lang', pick)
window.location.reload()
}
},
})
const cb = await asyncAlert<() => void>({
title: t('main_menu.title'),
text: ``,