[i18n] More Controller settings localization (#5920)

This commit is contained in:
Lugiad 2025-06-06 21:52:35 +02:00 committed by GitHub
parent 2a769e2733
commit 9021e4b41e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 10 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import { truncateString } from "../../utils/common";
import { Button } from "#enums/buttons"; import { Button } from "#enums/buttons";
import { SettingKeyboard } from "#app/system/settings/settings-keyboard"; import { SettingKeyboard } from "#app/system/settings/settings-keyboard";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import i18next from "i18next";
export enum SettingGamepad { export enum SettingGamepad {
Controller = "CONTROLLER", Controller = "CONTROLLER",
@ -27,11 +28,11 @@ export enum SettingGamepad {
Button_Submit = "BUTTON_SUBMIT", Button_Submit = "BUTTON_SUBMIT",
} }
const pressAction = "Press action to assign"; const pressAction = i18next.t("settings:pressActionToAssign");
export const settingGamepadOptions = { export const settingGamepadOptions = {
[SettingGamepad.Controller]: ["Default", "Change"], [SettingGamepad.Controller]: [i18next.t("settings:controllerDefault"), i18next.t("settings:controllerChange")],
[SettingGamepad.Gamepad_Support]: ["Auto", "Disabled"], [SettingGamepad.Gamepad_Support]: [i18next.t("settings:gamepadSupportAuto"), i18next.t("settings:gamepadSupportDisabled")],
[SettingGamepad.Button_Up]: [`KEY ${Button.UP.toString()}`, pressAction], [SettingGamepad.Button_Up]: [`KEY ${Button.UP.toString()}`, pressAction],
[SettingGamepad.Button_Down]: [`KEY ${Button.DOWN.toString()}`, pressAction], [SettingGamepad.Button_Down]: [`KEY ${Button.DOWN.toString()}`, pressAction],
[SettingGamepad.Button_Left]: [`KEY ${Button.LEFT.toString()}`, pressAction], [SettingGamepad.Button_Left]: [`KEY ${Button.LEFT.toString()}`, pressAction],
@ -140,7 +141,7 @@ export function setSettingGamepad(setting: SettingGamepad, value: number): boole
handler: () => changeGamepadHandler(g), handler: () => changeGamepadHandler(g),
})), })),
{ {
label: "Cancel", label: i18next.t("settings:cancelContollerChoice"),
handler: cancelHandler, handler: cancelHandler,
}, },
], ],

View File

@ -4,6 +4,7 @@ import { Device } from "#enums/devices";
import { getIconWithSettingName, getKeyWithKeycode } from "#app/configs/inputs/configHandler"; import { getIconWithSettingName, getKeyWithKeycode } from "#app/configs/inputs/configHandler";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject, TextStyle } from "#app/ui/text";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import i18next from "i18next";
export default class GamepadBindingUiHandler extends AbstractBindingUiHandler { export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {
constructor(mode: UiMode | null = null) { constructor(mode: UiMode | null = null) {
@ -19,7 +20,7 @@ export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {
this.newButtonIcon.setOrigin(0.5); this.newButtonIcon.setOrigin(0.5);
this.newButtonIcon.setVisible(false); this.newButtonIcon.setVisible(false);
this.swapText = addTextObject(0, 0, "will swap with", TextStyle.WINDOW); this.swapText = addTextObject(0, 0, i18next.t("settings:willSwapWith"), TextStyle.WINDOW);
this.swapText.setOrigin(0.5); this.swapText.setOrigin(0.5);
this.swapText.setPositionRelative( this.swapText.setPositionRelative(
this.optionSelectBg, this.optionSelectBg,
@ -33,7 +34,7 @@ export default class GamepadBindingUiHandler extends AbstractBindingUiHandler {
this.targetButtonIcon.setOrigin(0.5); this.targetButtonIcon.setOrigin(0.5);
this.targetButtonIcon.setVisible(false); this.targetButtonIcon.setVisible(false);
this.actionLabel = addTextObject(0, 0, "Confirm swap", TextStyle.SETTINGS_LABEL); this.actionLabel = addTextObject(0, 0, i18next.t("settings:confirmSwap"), TextStyle.SETTINGS_LABEL);
this.actionLabel.setOrigin(0, 0.5); this.actionLabel.setOrigin(0, 0.5);
this.actionLabel.setPositionRelative(this.actionBg, this.actionBg.width - 75, this.actionBg.height / 2); this.actionLabel.setPositionRelative(this.actionBg, this.actionBg.width - 75, this.actionBg.height / 2);
this.actionsContainer.add(this.actionLabel); this.actionsContainer.add(this.actionLabel);

View File

@ -4,6 +4,7 @@ import { getKeyWithKeycode } from "#app/configs/inputs/configHandler";
import { Device } from "#enums/devices"; import { Device } from "#enums/devices";
import { addTextObject, TextStyle } from "#app/ui/text"; import { addTextObject, TextStyle } from "#app/ui/text";
import { globalScene } from "#app/global-scene"; import { globalScene } from "#app/global-scene";
import i18next from "i18next";
export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler { export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler {
constructor(mode: UiMode | null = null) { constructor(mode: UiMode | null = null) {
@ -21,7 +22,7 @@ export default class KeyboardBindingUiHandler extends AbstractBindingUiHandler {
this.newButtonIcon.setOrigin(0.5); this.newButtonIcon.setOrigin(0.5);
this.newButtonIcon.setVisible(false); this.newButtonIcon.setVisible(false);
this.actionLabel = addTextObject(0, 0, "Assign button", TextStyle.SETTINGS_LABEL); this.actionLabel = addTextObject(0, 0, i18next.t("settings:assignButton"), TextStyle.SETTINGS_LABEL);
this.actionLabel.setOrigin(0, 0.5); this.actionLabel.setOrigin(0, 0.5);
this.actionLabel.setPositionRelative(this.actionBg, this.actionBg.width - 80, this.actionBg.height / 2); this.actionLabel.setPositionRelative(this.actionBg, this.actionBg.width - 80, this.actionBg.height / 2);
this.actionsContainer.add(this.actionLabel); this.actionsContainer.add(this.actionLabel);