From 6e52bc798023df95207e6b25a0a56912a108b726 Mon Sep 17 00:00:00 2001 From: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> Date: Wed, 12 Jun 2024 15:45:20 +0200 Subject: [PATCH] =?UTF-8?q?[Localization]=20Ability=20Bar=20can=20now=20be?= =?UTF-8?q?=20localized.=20In=20a=20way=20that=20pokemonName=20abilityNa?= =?UTF-8?q?=E2=80=A6=20(#1921)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Ability Bar can now be localized. In a way that pokemonName abilityName and passive string can be ordered freely * Update src/locales/ko/fight-ui-handler.ts Co-authored-by: returntoice * Update src/locales/de/fight-ui-handler.ts * Update src/locales/de/fight-ui-handler.ts --------- Co-authored-by: returntoice --- src/locales/de/fight-ui-handler.ts | 2 ++ src/locales/en/fight-ui-handler.ts | 2 ++ src/locales/es/fight-ui-handler.ts | 2 ++ src/locales/fr/fight-ui-handler.ts | 2 ++ src/locales/it/fight-ui-handler.ts | 2 ++ src/locales/ko/fight-ui-handler.ts | 2 ++ src/locales/pt_BR/fight-ui-handler.ts | 2 ++ src/locales/zh_CN/fight-ui-handler.ts | 4 +++- src/locales/zh_TW/fight-ui-handler.ts | 2 ++ src/ui/ability-bar.ts | 18 +++++++----------- 10 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/locales/de/fight-ui-handler.ts b/src/locales/de/fight-ui-handler.ts index 300272ab83f..4c6ec243a22 100644 --- a/src/locales/de/fight-ui-handler.ts +++ b/src/locales/de/fight-ui-handler.ts @@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = { "pp": "AP", "power": "Stärke", "accuracy": "Genauigkeit", + "abilityFlyInText": "{{passive}}{{abilityName}} von {{pokemonName}} wirkt!", + "passive": "Passive Fähigkeit ", // The space at the end is important } as const; diff --git a/src/locales/en/fight-ui-handler.ts b/src/locales/en/fight-ui-handler.ts index 1924041fe3b..a73c5c6d3d6 100644 --- a/src/locales/en/fight-ui-handler.ts +++ b/src/locales/en/fight-ui-handler.ts @@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = { "pp": "PP", "power": "Power", "accuracy": "Accuracy", + "abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}", + "passive": "Passive ", // The space at the end is important } as const; diff --git a/src/locales/es/fight-ui-handler.ts b/src/locales/es/fight-ui-handler.ts index 421e0fb993b..0d82cfb0ab5 100644 --- a/src/locales/es/fight-ui-handler.ts +++ b/src/locales/es/fight-ui-handler.ts @@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = { "pp": "PP", "power": "Potencia", "accuracy": "Precisión", + "abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}", + "passive": "Passive ", // The space at the end is important } as const; diff --git a/src/locales/fr/fight-ui-handler.ts b/src/locales/fr/fight-ui-handler.ts index bccfdd5cfb8..6be12179d28 100644 --- a/src/locales/fr/fight-ui-handler.ts +++ b/src/locales/fr/fight-ui-handler.ts @@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = { "pp": "PP", "power": "Puissance", "accuracy": "Précision", + "abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}", + "passive": "Passive ", // The space at the end is important } as const; diff --git a/src/locales/it/fight-ui-handler.ts b/src/locales/it/fight-ui-handler.ts index ee771263997..bd2cb0cfb0b 100644 --- a/src/locales/it/fight-ui-handler.ts +++ b/src/locales/it/fight-ui-handler.ts @@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = { "pp": "PP", "power": "Potenza", "accuracy": "Precisione", + "abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}", + "passive": "Passive ", // The space at the end is important } as const; diff --git a/src/locales/ko/fight-ui-handler.ts b/src/locales/ko/fight-ui-handler.ts index 7b6d8c2808c..6ce47e759fe 100644 --- a/src/locales/ko/fight-ui-handler.ts +++ b/src/locales/ko/fight-ui-handler.ts @@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = { "pp": "PP", "power": "위력", "accuracy": "명중률", + "abilityFlyInText": " {{pokemonName}}의 {{passive}}{{abilityName}}", + "passive": "패시브 ", // The space at the end is important } as const; diff --git a/src/locales/pt_BR/fight-ui-handler.ts b/src/locales/pt_BR/fight-ui-handler.ts index f223f72a9f1..c213a9e6e9b 100644 --- a/src/locales/pt_BR/fight-ui-handler.ts +++ b/src/locales/pt_BR/fight-ui-handler.ts @@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = { "pp": "PP", "power": "Poder", "accuracy": "Precisão", + "abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}", + "passive": "Passive ", // The space at the end is important } as const; diff --git a/src/locales/zh_CN/fight-ui-handler.ts b/src/locales/zh_CN/fight-ui-handler.ts index baa933f7ec0..7ccab7561da 100644 --- a/src/locales/zh_CN/fight-ui-handler.ts +++ b/src/locales/zh_CN/fight-ui-handler.ts @@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = { "pp": "PP", "power": "威力", "accuracy": "命中", -} as const; + "abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}", + "passive": "Passive ", // The space at the end is important +} as const; diff --git a/src/locales/zh_TW/fight-ui-handler.ts b/src/locales/zh_TW/fight-ui-handler.ts index eb10031ac86..64df373ea7a 100644 --- a/src/locales/zh_TW/fight-ui-handler.ts +++ b/src/locales/zh_TW/fight-ui-handler.ts @@ -4,4 +4,6 @@ export const fightUiHandler: SimpleTranslationEntries = { "pp": "PP", "power": "威力", "accuracy": "命中率", + "abilityFlyInText": " {{pokemonName}}'s {{passive}}{{abilityName}}", + "passive": "Passive ", // The space at the end is important } as const; diff --git a/src/ui/ability-bar.ts b/src/ui/ability-bar.ts index 58717c3d2d0..2bc5f028ddb 100644 --- a/src/ui/ability-bar.ts +++ b/src/ui/ability-bar.ts @@ -1,6 +1,7 @@ import BattleScene from "../battle-scene"; import Pokemon from "../field/pokemon"; import { TextStyle, addTextObject } from "./text"; +import i18next from "i18next"; const hiddenX = -118; const shownX = 0; @@ -8,8 +9,7 @@ const baseY = -116; export default class AbilityBar extends Phaser.GameObjects.Container { private bg: Phaser.GameObjects.Image; - private pokemonNameText: Phaser.GameObjects.Text; - private abilityNameText: Phaser.GameObjects.Text; + private abilityBarText: Phaser.GameObjects.Text; private tween: Phaser.Tweens.Tween; private autoHideTimer: NodeJS.Timeout; @@ -26,21 +26,17 @@ export default class AbilityBar extends Phaser.GameObjects.Container { this.add(this.bg); - this.pokemonNameText = addTextObject(this.scene, 15, 3, "", TextStyle.MESSAGE, { fontSize: "72px" }); - this.pokemonNameText.setOrigin(0, 0); - this.add(this.pokemonNameText); - - this.abilityNameText = addTextObject(this.scene, 97, 16, "", TextStyle.WINDOW, { fontSize: "72px" }); - this.abilityNameText.setOrigin(1, 0); - this.add(this.abilityNameText); + this.abilityBarText = addTextObject(this.scene, 15, 3, "", TextStyle.MESSAGE, { fontSize: "72px" }); + this.abilityBarText.setOrigin(0, 0); + this.abilityBarText.setWordWrapWidth(600, true); + this.add(this.abilityBarText); this.setVisible(false); this.shown = false; } showAbility(pokemon: Pokemon, passive: boolean = false): void { - this.pokemonNameText.setText(`${pokemon.name}'s${passive ? " Passive" : ""}`); - this.abilityNameText.setText((!passive ? pokemon.getAbility() : pokemon.getPassiveAbility()).name); + this.abilityBarText.setText(`${i18next.t("fightUiHandler:abilityFlyInText", { pokemonName: pokemon.name, passive: passive ? i18next.t("fightUiHandler:passive") : "", abilityName: !passive ? pokemon.getAbility().name : pokemon.getPassiveAbility().name })}`); if (this.shown) { return;