mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-22 04:56:15 -04:00
Added french translation and language switcher
This commit is contained in:
parent
7555ed0ff1
commit
1b4d2fba81
7 changed files with 341 additions and 298 deletions
30
src/game.ts
30
src/game.ts
|
@ -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: ``,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue