From 965bc687b38f3d5c0296ca1eede83b7569d86b15 Mon Sep 17 00:00:00 2001 From: Enoch Date: Mon, 8 Jul 2024 23:16:55 +0900 Subject: [PATCH] [Localization] Localize terrain message and translate in Korean (#2806) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add terrain localization and test code, change folder name * Update src/locales/fr/weather.ts Co-authored-by: Lugiad' * Update src/locales/pt_BR/weather.ts Co-authored-by: José Ricardo Fleury Oliveira * Update src/locales/zh_CN/weather.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Update src/locales/de/weather.ts Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> * Update src/locales/zh_TW/weather.ts Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> * Use testUtil * add missed en messages --------- Co-authored-by: Lugiad' Co-authored-by: José Ricardo Fleury Oliveira Co-authored-by: Yonmaru40 <47717431+40chyan@users.noreply.github.com> Co-authored-by: Jannik Tappert <38758606+CodeTappert@users.noreply.github.com> --- src/data/terrain.ts | 17 ++ src/data/weather.ts | 24 +-- src/locales/de/config.ts | 3 +- src/locales/de/weather.ts | 21 ++ src/locales/en/config.ts | 5 +- src/locales/en/weather.ts | 21 ++ src/locales/es/config.ts | 3 +- src/locales/es/weather.ts | 21 ++ src/locales/fr/config.ts | 3 +- src/locales/fr/weather.ts | 21 ++ src/locales/it/config.ts | 3 +- src/locales/it/weather.ts | 21 ++ src/locales/ko/config.ts | 3 +- src/locales/ko/weather.ts | 21 ++ src/locales/pt_BR/config.ts | 5 +- src/locales/pt_BR/weather.ts | 21 ++ src/locales/zh_CN/config.ts | 3 +- src/locales/zh_CN/weather.ts | 21 ++ src/locales/zh_TW/config.ts | 3 +- src/locales/zh_TW/weather.ts | 21 ++ .../battle-stat.test.ts | 0 .../french.test.ts | 0 .../status-effect.test.ts | 0 src/test/localization/terrain.test.ts | 192 ++++++++++++++++++ 24 files changed, 430 insertions(+), 23 deletions(-) rename src/test/{lokalisation => localization}/battle-stat.test.ts (100%) rename src/test/{lokalisation => localization}/french.test.ts (100%) rename src/test/{lokalisation => localization}/status-effect.test.ts (100%) create mode 100644 src/test/localization/terrain.test.ts diff --git a/src/data/terrain.ts b/src/data/terrain.ts index e396c693c4e..f7324c28b93 100644 --- a/src/data/terrain.ts +++ b/src/data/terrain.ts @@ -5,6 +5,7 @@ import * as Utils from "../utils"; import { IncrementMovePriorityAbAttr, applyAbAttrs } from "./ability"; import { ProtectAttr } from "./move"; import { BattlerIndex } from "#app/battle.js"; +import i18next from "i18next"; export enum TerrainType { NONE, @@ -67,6 +68,22 @@ export class Terrain { } } +export function getTerrainName(terrainType: TerrainType): string { + switch (terrainType) { + case TerrainType.MISTY: + return i18next.t("terrain:misty"); + case TerrainType.ELECTRIC: + return i18next.t("terrain:electric"); + case TerrainType.GRASSY: + return i18next.t("terrain:grassy"); + case TerrainType.PSYCHIC: + return i18next.t("terrain:psychic"); + } + + return ""; +} + + export function getTerrainColor(terrainType: TerrainType): [ integer, integer, integer ] { switch (terrainType) { case TerrainType.MISTY: diff --git a/src/data/weather.ts b/src/data/weather.ts index 425dd3724f6..f671c754873 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -1,12 +1,12 @@ import { Biome } from "#enums/biome"; -import { getPokemonMessage, getPokemonNameWithAffix } from "../messages"; +import { getPokemonNameWithAffix } from "../messages"; import Pokemon from "../field/pokemon"; import { Type } from "./type"; import Move, { AttackMove } from "./move"; import * as Utils from "../utils"; import BattleScene from "../battle-scene"; import { SuppressWeatherEffectAbAttr } from "./ability"; -import { TerrainType } from "./terrain"; +import { TerrainType, getTerrainName } from "./terrain"; import i18next from "i18next"; export enum WeatherType { @@ -216,34 +216,34 @@ export function getWeatherClearMessage(weatherType: WeatherType): string { export function getTerrainStartMessage(terrainType: TerrainType): string { switch (terrainType) { case TerrainType.MISTY: - return "Mist swirled around the battlefield!"; + return i18next.t("terrain:mistyStartMessage"); case TerrainType.ELECTRIC: - return "An electric current ran across the battlefield!"; + return i18next.t("terrain:electricStartMessage"); case TerrainType.GRASSY: - return "Grass grew to cover the battlefield!"; + return i18next.t("terrain:grassyStartMessage"); case TerrainType.PSYCHIC: - return "The battlefield got weird!"; + return i18next.t("terrain:psychicStartMessage"); } } export function getTerrainClearMessage(terrainType: TerrainType): string { switch (terrainType) { case TerrainType.MISTY: - return "The mist disappeared from the battlefield."; + return i18next.t("terrain:mistyClearMessage"); case TerrainType.ELECTRIC: - return "The electricity disappeared from the battlefield."; + return i18next.t("terrain:electricClearMessage"); case TerrainType.GRASSY: - return "The grass disappeared from the battlefield."; + return i18next.t("terrain:grassyClearMessage"); case TerrainType.PSYCHIC: - return "The weirdness disappeared from the battlefield!"; + return i18next.t("terrain:psychicClearMessage"); } } export function getTerrainBlockMessage(pokemon: Pokemon, terrainType: TerrainType): string { if (terrainType === TerrainType.MISTY) { - return getPokemonMessage(pokemon, " surrounds itself with a protective mist!"); + return i18next.t("terrain:mistyBlockMessage", {pokemonNameWithAffix: getPokemonNameWithAffix(pokemon)}); } - return getPokemonMessage(pokemon, ` is protected by the ${Utils.toReadableString(TerrainType[terrainType])} Terrain!`); + return i18next.t("terrain:defaultBlockMessage", {pokemonNameWithAffix: getPokemonNameWithAffix(pokemon), terrainName: getTerrainName(terrainType)}); } interface WeatherPoolEntry { diff --git a/src/locales/de/config.ts b/src/locales/de/config.ts index 92544d87ea3..3c16f81270d 100644 --- a/src/locales/de/config.ts +++ b/src/locales/de/config.ts @@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect"; import { titles, trainerClasses, trainerNames } from "./trainers"; import { tutorial } from "./tutorial"; import { voucher } from "./voucher"; -import { weather } from "./weather"; +import { terrain, weather } from "./weather"; import { partyUiHandler } from "./party-ui-handler"; import { settings } from "./settings.js"; import { common } from "./common.js"; @@ -85,6 +85,7 @@ export const deConfig = { splashMessages: splashMessages, starterSelectUiHandler: starterSelectUiHandler, statusEffect: statusEffect, + terrain: terrain, titles: titles, trainerClasses: trainerClasses, trainerNames: trainerNames, diff --git a/src/locales/de/weather.ts b/src/locales/de/weather.ts index 305fd7e7827..8a820f3d549 100644 --- a/src/locales/de/weather.ts +++ b/src/locales/de/weather.ts @@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = { "strongWindsEffectMessage": "Rätselhafte Luftströmungen haben den Angriff abgeschwächt!", "strongWindsClearMessage": "Die rätselhafte Luftströmung hat sich wieder geleget.", }; + +export const terrain: SimpleTranslationEntries = { + "misty": "Nebelfeld", + "mistyStartMessage": "Am Boden breitet sich dichter Nebel aus!", + "mistyClearMessage": "Das Nebelfeld ist wieder verschwunden!", + "mistyBlockMessage": "{{pokemonNameWithAffix}} wird vom Nebelfeld geschützt!", + + "electric": "Elektrofeld", + "electricStartMessage": "Elektrische Energie fließt durch den Boden!", + "electricClearMessage": "Das Elektrofeld ist wieder verschwunden!", + + "grassy": "Grasfeld", + "grassyStartMessage": "Dichtes Gras schießt aus dem Boden!", + "grassyClearMessage": "Das Grasfeld ist wieder verschwunden!", + + "psychic": "Psychofeld", + "psychicStartMessage": "Der Boden fühlt sich seltsam an!", + "psychicClearMessage": "Das Psychofeld ist wieder verschwunden!", + + "defaultBlockMessage": "{{pokemonNameWithAffix}} wird vom {{terrainName}} geschützt!" +}; diff --git a/src/locales/en/config.ts b/src/locales/en/config.ts index a318bbe0128..b0c1b7a7105 100644 --- a/src/locales/en/config.ts +++ b/src/locales/en/config.ts @@ -42,7 +42,7 @@ import { statusEffect } from "./status-effect"; import { titles, trainerClasses, trainerNames } from "./trainers"; import { tutorial } from "./tutorial"; import { voucher } from "./voucher"; -import { weather } from "./weather"; +import { terrain, weather } from "./weather"; import { modifierSelectUiHandler } from "./modifier-select-ui-handler"; export const enConfig = { @@ -76,7 +76,6 @@ export const enConfig = { modifierType: modifierType, move: move, nature: nature, - partyUiHandler: partyUiHandler, pokeball: pokeball, pokemon: pokemon, pokemonInfo: pokemonInfo, @@ -86,11 +85,13 @@ export const enConfig = { splashMessages: splashMessages, starterSelectUiHandler: starterSelectUiHandler, statusEffect: statusEffect, + terrain: terrain, titles: titles, trainerClasses: trainerClasses, trainerNames: trainerNames, tutorial: tutorial, voucher: voucher, weather: weather, + partyUiHandler: partyUiHandler, modifierSelectUiHandler: modifierSelectUiHandler }; diff --git a/src/locales/en/weather.ts b/src/locales/en/weather.ts index c7b2963ccd8..8222064f341 100644 --- a/src/locales/en/weather.ts +++ b/src/locales/en/weather.ts @@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = { "strongWindsEffectMessage": "The mysterious air current weakened the attack!", "strongWindsClearMessage": "The heavy wind stopped." }; + +export const terrain: SimpleTranslationEntries = { + "misty": "Misty", + "mistyStartMessage": "Mist swirled around the battlefield!", + "mistyClearMessage": "The mist disappeared from the battlefield.", + "mistyBlockMessage": "{{pokemonNameWithAffix}} surrounds itself with a protective mist!", + + "electric": "Electric", + "electricStartMessage": "An electric current ran across the battlefield!", + "electricClearMessage": "The electricity disappeared from the battlefield.", + + "grassy": "Grassy", + "grassyStartMessage": "Grass grew to cover the battlefield!", + "grassyClearMessage": "The grass disappeared from the battlefield.", + + "psychic": "Psychic", + "psychicStartMessage": "The battlefield got weird!", + "psychicClearMessage": "The weirdness disappeared from the battlefield!", + + "defaultBlockMessage": "{{pokemonNameWithAffix}} is protected by the {{terrainName}} Terrain!" +}; diff --git a/src/locales/es/config.ts b/src/locales/es/config.ts index bedd53dcc29..c37f96a2aa5 100644 --- a/src/locales/es/config.ts +++ b/src/locales/es/config.ts @@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect"; import { titles, trainerClasses, trainerNames } from "./trainers"; import { tutorial } from "./tutorial"; import { voucher } from "./voucher"; -import { weather } from "./weather"; +import { terrain, weather } from "./weather"; import { partyUiHandler } from "./party-ui-handler"; import { settings } from "./settings.js"; import { common } from "./common.js"; @@ -85,6 +85,7 @@ export const esConfig = { splashMessages: splashMessages, starterSelectUiHandler: starterSelectUiHandler, statusEffect: statusEffect, + terrain: terrain, titles: titles, trainerClasses: trainerClasses, trainerNames: trainerNames, diff --git a/src/locales/es/weather.ts b/src/locales/es/weather.ts index 37f574878dc..1129443d71b 100644 --- a/src/locales/es/weather.ts +++ b/src/locales/es/weather.ts @@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = { "strongWindsEffectMessage": "¡Las misteriosas turbulencias atenúan el ataque!", "strongWindsClearMessage": "El fuerte viento cesó." }; + +export const terrain: SimpleTranslationEntries = { + "misty": "Misty", + "mistyStartMessage": "Mist swirled around the battlefield!", + "mistyClearMessage": "The mist disappeared from the battlefield.", + "mistyBlockMessage": "{{pokemonNameWithAffix}} surrounds itself with a protective mist!", + + "electric": "Electric", + "electricStartMessage": "An electric current ran across the battlefield!", + "electricClearMessage": "The electricity disappeared from the battlefield.", + + "grassy": "Grassy", + "grassyStartMessage": "Grass grew to cover the battlefield!", + "grassyClearMessage": "The grass disappeared from the battlefield.", + + "psychic": "Psychic", + "psychicStartMessage": "The battlefield got weird!", + "psychicClearMessage": "The weirdness disappeared from the battlefield!", + + "defaultBlockMessage": "{{pokemonNameWithAffix}} is protected by the {{terrainName}} Terrain!" +}; diff --git a/src/locales/fr/config.ts b/src/locales/fr/config.ts index 55eae8c1dd5..af18aab3400 100644 --- a/src/locales/fr/config.ts +++ b/src/locales/fr/config.ts @@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect"; import { titles, trainerClasses, trainerNames } from "./trainers"; import { tutorial } from "./tutorial"; import { voucher } from "./voucher"; -import { weather } from "./weather"; +import { terrain, weather } from "./weather"; import { partyUiHandler } from "./party-ui-handler"; import { settings } from "./settings.js"; import { common } from "./common.js"; @@ -85,6 +85,7 @@ export const frConfig = { splashMessages: splashMessages, starterSelectUiHandler: starterSelectUiHandler, statusEffect: statusEffect, + terrain: terrain, titles: titles, trainerClasses: trainerClasses, trainerNames: trainerNames, diff --git a/src/locales/fr/weather.ts b/src/locales/fr/weather.ts index 3df8d0e20c9..3427748480e 100644 --- a/src/locales/fr/weather.ts +++ b/src/locales/fr/weather.ts @@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = { "strongWindsEffectMessage": "Le courant aérien mystérieux affaiblit l’attaque !", "strongWindsClearMessage": "Le vent mystérieux s’est dissipé…" }; + +export const terrain: SimpleTranslationEntries = { + "misty": "Brumeux", + "mistyStartMessage": "La brume recouvre le terrain !", + "mistyClearMessage": "La brume qui recouvrait le terrain se dissipe…", + "mistyBlockMessage": "La brume enveloppe {{pokemonNameWithAffix}} !", + + "electric": "Électrifié", + "electricStartMessage": "De l’électricité parcourt le terrain !", + "electricClearMessage": "L’électricité parcourant le terrain s’est dissipée…", + + "grassy": "Herbu", + "grassyStartMessage": "Un beau gazon pousse sur le terrain !", + "grassyClearMessage": "Le gazon disparait…", + + "psychic": "Psychique", + "psychicStartMessage": "Le sol se met à réagir de façon bizarre…", + "psychicClearMessage": "Le sol redevient normal !", + + "defaultBlockMessage": "{{pokemonNameWithAffix}} est protégé\npar le Champ {{terrainName}} !" +}; diff --git a/src/locales/it/config.ts b/src/locales/it/config.ts index 9175d40b97f..ac77e814623 100644 --- a/src/locales/it/config.ts +++ b/src/locales/it/config.ts @@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect"; import { titles, trainerClasses, trainerNames } from "./trainers"; import { tutorial } from "./tutorial"; import { voucher } from "./voucher"; -import { weather } from "./weather"; +import { terrain, weather } from "./weather"; import { partyUiHandler } from "./party-ui-handler"; import { settings } from "./settings.js"; import { common } from "./common.js"; @@ -85,6 +85,7 @@ export const itConfig = { splashMessages: splashMessages, starterSelectUiHandler: starterSelectUiHandler, statusEffect: statusEffect, + terrain: terrain, titles: titles, trainerClasses: trainerClasses, trainerNames: trainerNames, diff --git a/src/locales/it/weather.ts b/src/locales/it/weather.ts index f5d8e3b9397..604108435c3 100644 --- a/src/locales/it/weather.ts +++ b/src/locales/it/weather.ts @@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = { "strongWindsEffectMessage": "La corrente misteriosa indebolisce l’attacco!", "strongWindsClearMessage": "La corrente d'aria è cessata." }; + +export const terrain: SimpleTranslationEntries = { + "misty": "Misty", + "mistyStartMessage": "Mist swirled around the battlefield!", + "mistyClearMessage": "The mist disappeared from the battlefield.", + "mistyBlockMessage": "{{pokemonNameWithAffix}} surrounds itself with a protective mist!", + + "electric": "Electric", + "electricStartMessage": "An electric current ran across the battlefield!", + "electricClearMessage": "The electricity disappeared from the battlefield.", + + "grassy": "Grassy", + "grassyStartMessage": "Grass grew to cover the battlefield!", + "grassyClearMessage": "The grass disappeared from the battlefield.", + + "psychic": "Psychic", + "psychicStartMessage": "The battlefield got weird!", + "psychicClearMessage": "The weirdness disappeared from the battlefield!", + + "defaultBlockMessage": "{{pokemonNameWithAffix}} is protected by the {{terrainName}} Terrain!" +}; diff --git a/src/locales/ko/config.ts b/src/locales/ko/config.ts index dc64e12356a..fa81dee55ab 100644 --- a/src/locales/ko/config.ts +++ b/src/locales/ko/config.ts @@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect"; import { titles, trainerClasses, trainerNames } from "./trainers"; import { tutorial } from "./tutorial"; import { voucher } from "./voucher"; -import { weather } from "./weather"; +import { terrain, weather } from "./weather"; import { partyUiHandler } from "./party-ui-handler"; import { settings } from "./settings.js"; import { common } from "./common.js"; @@ -85,6 +85,7 @@ export const koConfig = { splashMessages: splashMessages, starterSelectUiHandler: starterSelectUiHandler, statusEffect: statusEffect, + terrain: terrain, titles: titles, trainerClasses: trainerClasses, trainerNames: trainerNames, diff --git a/src/locales/ko/weather.ts b/src/locales/ko/weather.ts index 9aca57c49d2..c89cc335859 100644 --- a/src/locales/ko/weather.ts +++ b/src/locales/ko/weather.ts @@ -44,3 +44,24 @@ export const weather: SimpleTranslationEntries = { "strongWindsEffectMessage": "수수께끼의 난기류가 공격을 약하게 만들었다!", "strongWindsClearMessage": "수수께끼의 난기류가 멈췄다!" // 임의번역 }; + +export const terrain: SimpleTranslationEntries = { + "misty": "미스트필드", + "mistyStartMessage": "발밑이 안개로 자욱해졌다!", + "mistyClearMessage": "발밑의 안개가 사라졌다!", + "mistyBlockMessage": "{{pokemonNameWithAffix}}[[를]]\n미스트필드가 지켜주고 있다!", + + "electric": "일렉트릭필드", + "electricStartMessage": "발밑에 전기가 흐르기 시작했다!", + "electricClearMessage": "발밑의 전기가 사라졌다!", + + "grassy": "그래스필드", + "grassyStartMessage": "발밑에 풀이 무성해졌다!", + "grassyClearMessage": "발밑의 풀이 사라졌다!", + + "psychic": "사이코필드", + "psychicStartMessage": "발밑에서 이상한 느낌이 든다!", + "psychicClearMessage": "발밑의 이상한 느낌이 사라졌다!", + + "defaultBlockMessage": "{{pokemonNameWithAffix}}[[를]]\n{{terrainName}}[[가]] 지켜주고 있다!" +}; diff --git a/src/locales/pt_BR/config.ts b/src/locales/pt_BR/config.ts index 5a571815c97..4b3649f96ad 100644 --- a/src/locales/pt_BR/config.ts +++ b/src/locales/pt_BR/config.ts @@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect"; import { titles, trainerClasses, trainerNames } from "./trainers"; import { tutorial } from "./tutorial"; import { voucher } from "./voucher"; -import { weather } from "./weather"; +import { terrain, weather } from "./weather"; import { partyUiHandler } from "./party-ui-handler"; import { settings } from "./settings.js"; import { common } from "./common.js"; @@ -76,13 +76,13 @@ export const ptBrConfig = { modifierType: modifierType, move: move, nature: nature, - partyUiHandler: partyUiHandler, pokeball: pokeball, pokemon: pokemon, pokemonInfo: pokemonInfo, pokemonInfoContainer: pokemonInfoContainer, saveSlotSelectUiHandler: saveSlotSelectUiHandler, statusEffect: statusEffect, + terrain: terrain, settings: settings, splashMessages: splashMessages, starterSelectUiHandler: starterSelectUiHandler, @@ -92,5 +92,6 @@ export const ptBrConfig = { tutorial: tutorial, voucher: voucher, weather: weather, + partyUiHandler: partyUiHandler, modifierSelectUiHandler: modifierSelectUiHandler }; diff --git a/src/locales/pt_BR/weather.ts b/src/locales/pt_BR/weather.ts index 0787b32e416..31e35657c7f 100644 --- a/src/locales/pt_BR/weather.ts +++ b/src/locales/pt_BR/weather.ts @@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = { "strongWindsEffectMessage": "The mysterious air current weakened the attack!", "strongWindsClearMessage": "Os ventos fortes diminuíram.", }; + +export const terrain: SimpleTranslationEntries = { + "misty": "Enevoado", + "mistyStartMessage": "Uma névoa se espalhou pelo campo de batalha!", + "mistyClearMessage": "A névou sumiu do campo de batalha.", + "mistyBlockMessage": "{{pokemonNameWithAffix}} se envolveu com uma névoa protetora!", + + "electric": "Elétrico", + "electricStartMessage": "Uma corrente elétrica se espalhou pelo campo de batalha!", + "electricClearMessage": "A eletricidade sumiu do campo de batalha.", + + "grassy": "de Plantas", + "grassyStartMessage": "Grama cresceu para cobrir o campo de batalha!", + "grassyClearMessage": "A grama sumiu do campo de batalha.", + + "psychic": "Psíquico", + "psychicStartMessage": "O campo de batalha ficou esquisito!", + "psychicClearMessage": "A esquisitice sumiu do campo de batalha", + + "defaultBlockMessage": "{{pokemonNameWithAffix}} está protegido pelo Terreno {{terrainName}}!" +}; diff --git a/src/locales/zh_CN/config.ts b/src/locales/zh_CN/config.ts index 8f654b56d9a..b55b2aa865c 100644 --- a/src/locales/zh_CN/config.ts +++ b/src/locales/zh_CN/config.ts @@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect"; import { titles, trainerClasses, trainerNames } from "./trainers"; import { tutorial } from "./tutorial"; import { voucher } from "./voucher"; -import { weather } from "./weather"; +import { terrain, weather } from "./weather"; import { partyUiHandler } from "./party-ui-handler"; import { settings } from "./settings.js"; import { common } from "./common.js"; @@ -85,6 +85,7 @@ export const zhCnConfig = { splashMessages: splashMessages, starterSelectUiHandler: starterSelectUiHandler, statusEffect: statusEffect, + terrain: terrain, titles: titles, trainerClasses: trainerClasses, trainerNames: trainerNames, diff --git a/src/locales/zh_CN/weather.ts b/src/locales/zh_CN/weather.ts index d280dfccb95..ea4deffbd55 100644 --- a/src/locales/zh_CN/weather.ts +++ b/src/locales/zh_CN/weather.ts @@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = { "strongWindsEffectMessage": "The mysterious air current weakened the attack!", "strongWindsClearMessage": "神秘的乱流停止了。" }; + +export const terrain: SimpleTranslationEntries = { + "misty": "薄雾", + "mistyStartMessage": "脚下雾气缭绕!", + "mistyClearMessage": "脚下的雾气消失不见了!", + "mistyBlockMessage": "{{pokemonNameWithAffix}}正受到薄雾场地的保护!", + + "electric": "电气", + "electricStartMessage": "脚下电光飞闪!", + "electricClearMessage": "脚下的电光消失不见了!", + + "grassy": "青草", + "grassyStartMessage": "脚下青草如茵!", + "grassyClearMessage": "脚下的青草消失不见了!", + + "psychic": "精神", + "psychicStartMessage": "脚下传来了奇妙的感觉!", + "psychicClearMessage": "脚下的奇妙感觉消失了!", + + "defaultBlockMessage": "{{pokemonNameWithAffix}}正受到{{terrainName}}的的保护!" +}; diff --git a/src/locales/zh_TW/config.ts b/src/locales/zh_TW/config.ts index e4dfafdd43e..6886a750d62 100644 --- a/src/locales/zh_TW/config.ts +++ b/src/locales/zh_TW/config.ts @@ -39,7 +39,7 @@ import { statusEffect } from "./status-effect"; import { titles, trainerClasses, trainerNames } from "./trainers"; import { tutorial } from "./tutorial"; import { voucher } from "./voucher"; -import { weather } from "./weather"; +import { terrain, weather } from "./weather"; import { partyUiHandler } from "./party-ui-handler"; import { settings } from "./settings.js"; import { common } from "./common.js"; @@ -85,6 +85,7 @@ export const zhTwConfig = { splashMessages: splashMessages, starterSelectUiHandler: starterSelectUiHandler, statusEffect: statusEffect, + terrain: terrain, titles: titles, trainerClasses: trainerClasses, trainerNames: trainerNames, diff --git a/src/locales/zh_TW/weather.ts b/src/locales/zh_TW/weather.ts index ae0646ce33d..bfc5e0998dc 100644 --- a/src/locales/zh_TW/weather.ts +++ b/src/locales/zh_TW/weather.ts @@ -43,3 +43,24 @@ export const weather: SimpleTranslationEntries = { "strongWindsEffectMessage": "The mysterious air current weakened the attack!", "strongWindsClearMessage": "神秘的亂流停止了。" }; + +export const terrain: SimpleTranslationEntries = { + "misty": "薄霧", + "mistyStartMessage": "腳下霧氣繚繞!", + "mistyClearMessage": "腳下的霧氣消失不見了!", + "mistyBlockMessage": "{{pokemonNameWithAffix}}正受到薄霧場地的保護!", + + "electric": "電氣", + "electricStartMessage": "腳下電流飛閃!", + "electricClearMessage": "腳下的電流消失了!", + + "grassy": "青草", + "grassyStartMessage": "腳下青草如茵!", + "grassyClearMessage": "腳下的青草消失不見了!", + + "psychic": "精神", + "psychicStartMessage": "腳下傳來了奇妙的感覺!", + "psychicClearMessage": "腳下的奇妙感覺消失了!", + + "defaultBlockMessage": "{{pokemonNameWithAffix}}正受到{{terrainName}}的保護!" +}; diff --git a/src/test/lokalisation/battle-stat.test.ts b/src/test/localization/battle-stat.test.ts similarity index 100% rename from src/test/lokalisation/battle-stat.test.ts rename to src/test/localization/battle-stat.test.ts diff --git a/src/test/lokalisation/french.test.ts b/src/test/localization/french.test.ts similarity index 100% rename from src/test/lokalisation/french.test.ts rename to src/test/localization/french.test.ts diff --git a/src/test/lokalisation/status-effect.test.ts b/src/test/localization/status-effect.test.ts similarity index 100% rename from src/test/lokalisation/status-effect.test.ts rename to src/test/localization/status-effect.test.ts diff --git a/src/test/localization/terrain.test.ts b/src/test/localization/terrain.test.ts new file mode 100644 index 00000000000..89884290e00 --- /dev/null +++ b/src/test/localization/terrain.test.ts @@ -0,0 +1,192 @@ +import { beforeAll, describe, beforeEach, afterEach, expect, it, vi } from "vitest"; +import Phaser from "phaser"; +import GameManager from "#app/test/utils/gameManager"; +import * as overrides from "#app/overrides"; +import { Species } from "#enums/species"; +import { TerrainType, getTerrainName } from "#app/data/terrain"; +import { getTerrainStartMessage, getTerrainClearMessage, getTerrainBlockMessage } from "#app/data/weather"; +import i18next from "i18next"; +import { mockI18next } from "../utils/testUtils"; + +describe("terrain", () => { + let phaserGame: Phaser.Game; + let game: GameManager; + + beforeAll(() => { + phaserGame = new Phaser.Game({ + type: Phaser.HEADLESS, + }); + i18next.init(); + }); + + beforeEach(() => { + game = new GameManager(phaserGame); + vi.spyOn(overrides, "SINGLE_BATTLE_OVERRIDE", "get").mockReturnValue(true); + }); + + describe("NONE", () => { + const terrainType = TerrainType.NONE; + + it("should return the obtain text", () => { + mockI18next(); + + const text = getTerrainName(terrainType); + expect(text).toBe(""); + }); + + it("should return the start text", () => { + mockI18next(); + + const text = getTerrainStartMessage(terrainType); + expect(text).toBe(undefined); + }); + + it("should return the clear text", () => { + mockI18next(); + const text = getTerrainClearMessage(terrainType); + expect(text).toBe(undefined); + }); + + it("should return the block text", async () => { + await game.startBattle([Species.MAGIKARP]); + const pokemon = game.scene.getPlayerPokemon(); + mockI18next(); + const text = getTerrainBlockMessage(pokemon, terrainType); + expect(text).toBe("terrain:defaultBlockMessage"); + }); + }); + + describe("MISTY", () => { + const terrainType = TerrainType.MISTY; + + it("should return the obtain text", () => { + mockI18next(); + + const text = getTerrainName(terrainType); + expect(text).toBe("terrain:misty"); + }); + + it("should return the start text", () => { + mockI18next(); + + const text = getTerrainStartMessage(terrainType); + expect(text).toBe("terrain:mistyStartMessage"); + }); + + it("should return the clear text", () => { + mockI18next(); + const text = getTerrainClearMessage(terrainType); + expect(text).toBe("terrain:mistyClearMessage"); + }); + + it("should return the block text", async () => { + await game.startBattle([Species.MAGIKARP]); + const pokemon = game.scene.getPlayerPokemon(); + mockI18next(); + const text = getTerrainBlockMessage(pokemon, terrainType); + expect(text).toBe("terrain:mistyBlockMessage"); + }); + }); + + describe("ELECTRIC", () => { + const terrainType = TerrainType.ELECTRIC; + + it("should return the obtain text", () => { + mockI18next(); + + const text = getTerrainName(terrainType); + expect(text).toBe("terrain:electric"); + }); + + it("should return the start text", () => { + mockI18next(); + + const text = getTerrainStartMessage(terrainType); + expect(text).toBe("terrain:electricStartMessage"); + }); + + it("should return the clear text", () => { + mockI18next(); + const text = getTerrainClearMessage(terrainType); + expect(text).toBe("terrain:electricClearMessage"); + }); + + it("should return the block text", async () => { + await game.startBattle([Species.MAGIKARP]); + const pokemon = game.scene.getPlayerPokemon(); + mockI18next(); + const text = getTerrainBlockMessage(pokemon, terrainType); + expect(text).toBe("terrain:defaultBlockMessage"); + }); + }); + + describe("GRASSY", () => { + const terrainType = TerrainType.GRASSY; + + it("should return the obtain text", () => { + mockI18next(); + + const text = getTerrainName(terrainType); + expect(text).toBe("terrain:grassy"); + }); + + it("should return the start text", () => { + mockI18next(); + + const text = getTerrainStartMessage(terrainType); + expect(text).toBe("terrain:grassyStartMessage"); + }); + + it("should return the clear text", () => { + mockI18next(); + const text = getTerrainClearMessage(terrainType); + expect(text).toBe("terrain:grassyClearMessage"); + }); + + it("should return the block text", async () => { + await game.startBattle([Species.MAGIKARP]); + const pokemon = game.scene.getPlayerPokemon(); + mockI18next(); + const text = getTerrainBlockMessage(pokemon, terrainType); + expect(text).toBe("terrain:defaultBlockMessage"); + }); + }); + + describe("PSYCHIC", () => { + const terrainType = TerrainType.PSYCHIC; + + it("should return the obtain text", () => { + mockI18next(); + + const text = getTerrainName(terrainType); + expect(text).toBe("terrain:psychic"); + }); + + it("should return the start text", () => { + mockI18next(); + + const text = getTerrainStartMessage(terrainType); + expect(text).toBe("terrain:psychicStartMessage"); + }); + + it("should return the clear text", () => { + mockI18next(); + const text = getTerrainClearMessage(terrainType); + expect(text).toBe("terrain:psychicClearMessage"); + }); + + it("should return the block text", async () => { + await game.startBattle([Species.MAGIKARP]); + const pokemon = game.scene.getPlayerPokemon(); + mockI18next(); + const text = getTerrainBlockMessage(pokemon, terrainType); + expect(text).toBe("terrain:defaultBlockMessage"); + }); + }); + + + afterEach(() => { + game.phaseInterceptor.restoreOg(); + vi.resetAllMocks(); + }); +});