Extracted english translations

This commit is contained in:
Renan LE CARO 2025-03-15 21:29:38 +01:00
parent 7999777f69
commit 7555ed0ff1
14 changed files with 10224 additions and 2910 deletions

View file

@ -1,17 +1,19 @@
import { fitSize } from "./game";
import {fitSize} from "./game";
import {t} from "./i18n/i18n";
import {getSettingValue, setSettingValue} from "./settings";
export const options = {
sound: {
default: true,
name: `Game sounds`,
help: `Can slow down some phones.`,
name: t('main_menu.sounds'),
help: t('main_menu.sounds_help'),
afterChange: () => {},
disabled: () => false,
},
"mobile-mode": {
default: window.innerHeight > window.innerWidth,
name: `Mobile mode`,
help: `Leaves space for your thumb.`,
name: t('main_menu.mobile'),
help: t('main_menu.mobile_help'),
afterChange() {
fitSize();
},
@ -19,29 +21,30 @@ export const options = {
},
basic: {
default: false,
name: `Basic graphics`,
help: `Better performance on older devices.`,
name: t('main_menu.basic'),
help: t('main_menu.basic_help'),
afterChange: () => {},
disabled: () => false,
},
pointerLock: {
default: false,
name: `Mouse pointer lock`,
help: `Locks and hides the mouse cursor.`,
name: t('main_menu.pointer_lock'),
help: t('main_menu.pointer_lock_help'),
afterChange: () => {},
disabled: () => !document.body.requestPointerLock,
},
easy: {
default: false,
name: `Kids mode`,
help: `Start future runs with "slower ball".`,
name: t('main_menu.kid'),
help: t('main_menu.kid_help'),
afterChange: () => {},
disabled: () => false,
}, // Could not get the sharing to work without loading androidx and all the modern android things so for now i'll just disable sharing in the android app
},
// Could not get the sharing to work without loading androidx and all the modern android things so for now I'll just disable sharing in the android app
record: {
default: false,
name: `Record gameplay videos`,
help: `Get a video of each level.`,
name: t('main_menu.record'),
help: t('main_menu.record_help'),
afterChange: () => {},
disabled() {
return window.location.search.includes("isInWebView=true");
@ -57,3 +60,12 @@ export type OptionDef = {
afterChange: () => void;
};
export type OptionId = keyof typeof options;
export function isOptionOn(key: OptionId) {
return getSettingValue(key, options[key]?.default)
}
export function toggleOption(key: OptionId) {
setSettingValue(key, !isOptionOn(key))
options[key].afterChange();
}