diff --git a/src/data/ability.ts b/src/data/ability.ts index a257525efd0..dc446638900 100644 --- a/src/data/ability.ts +++ b/src/data/ability.ts @@ -18,7 +18,7 @@ import { Moves } from "./enums/moves"; import { TerrainType } from "./terrain"; import { SpeciesFormChangeManualTrigger } from "./pokemon-forms"; import { Abilities } from "./enums/abilities"; -import i18next, { Localizable } from "#app/plugins/i18n.js"; +import i18next, { Localizable } from "#app/plugins/i18n"; import { Command } from "../ui/command-ui-handler"; import Battle from "#app/battle.js"; import { ability } from "#app/locales/en/ability.js"; diff --git a/src/data/battle-stat.ts b/src/data/battle-stat.ts index e0cb6fb53f0..ab7da8bd3ed 100644 --- a/src/data/battle-stat.ts +++ b/src/data/battle-stat.ts @@ -8,23 +8,23 @@ export enum BattleStat { EVA, RAND } - +import i18next from "#app/plugins/i18n"; export function getBattleStatName(stat: BattleStat) { switch (stat) { case BattleStat.ATK: - return 'Attack'; + return i18next.t('battle:Attack'); case BattleStat.DEF: - return 'Defense'; + return i18next.t('battle:Defense'); case BattleStat.SPATK: - return 'Sp. Atk'; + return i18next.t('battle:Sp_Atk'); case BattleStat.SPDEF: - return 'Sp. Def'; + return i18next.t('battle:Sp_Def'); case BattleStat.SPD: - return 'Speed'; + return i18next.t('battle:Speed'); case BattleStat.ACC: - return 'Accuracy'; + return i18next.t('battle:Accuracy'); case BattleStat.EVA: - return 'Evasiveness'; + return i18next.t('battle:Evasiveness'); default: return '???'; } @@ -34,30 +34,30 @@ export function getBattleStatLevelChangeDescription(levels: integer, up: boolean if (up) { switch (levels) { case 1: - return 'rose'; + return i18next.t('battle:rose'); case 2: - return 'sharply rose'; + return i18next.t('battle:sharply_rose'); case 3: case 4: case 5: case 6: - return 'rose drastically'; + return i18next.t('battle:rose_drastically'); default: - return 'won\'t go any higher'; + return i18next.t('battle:won_t_go_any_higher'); } } else { switch (levels) { case 1: - return 'fell'; + return i18next.t('battle:fell'); case 2: - return 'harshly fell'; + return i18next.t('battle:harshly_fell'); case 3: case 4: case 5: case 6: - return 'severely fell'; + return i18next.t('battle:severely_fell'); default: - return 'won\'t go any lower'; + return i18next.t('battle:won_t_go_any_lower'); } } } \ No newline at end of file diff --git a/src/data/berry.ts b/src/data/berry.ts index 96b50caa932..c1e21177828 100644 --- a/src/data/berry.ts +++ b/src/data/berry.ts @@ -7,7 +7,7 @@ import { BattlerTagType } from "./enums/battler-tag-type"; import { getStatusEffectHealText } from "./status-effect"; import * as Utils from "../utils"; import { DoubleBerryEffectAbAttr, ReduceBerryUseThresholdAbAttr, applyAbAttrs } from "./ability"; - +import i18next from '../plugins/i18n'; export enum BerryType { SITRUS, LUM, @@ -23,30 +23,30 @@ export enum BerryType { } export function getBerryName(berryType: BerryType) { - return `${Utils.toReadableString(BerryType[berryType])} Berry`; + return `${Utils.toReadableString(BerryType[berryType])} `+i18next.t('berry:Berry'); } export function getBerryEffectDescription(berryType: BerryType) { switch (berryType) { case BerryType.SITRUS: - return 'Restores 25% HP if HP is below 50%'; + return i18next.t('berry:Restores_25%_HP_if_HP_is_below_50%'); case BerryType.LUM: - return 'Cures any non-volatile status condition and confusion'; + return i18next.t('berry:Cures_any_non-volatile_status_condition_and_confusion'); case BerryType.ENIGMA: - return 'Restores 25% HP if hit by a super effective move'; + return i18next.t('berry:Restores_25%_HP_if_hit_by_a_super_effective_move'); case BerryType.LIECHI: case BerryType.GANLON: case BerryType.PETAYA: case BerryType.APICOT: case BerryType.SALAC: const stat = (berryType - BerryType.LIECHI) as BattleStat; - return `Raises ${getBattleStatName(stat)} if HP is below 25%`; + return `${i18next.t('berry:Raises')} ${getBattleStatName(stat)} `+i18next.t('berry:if_HP_is_below_25%'); case BerryType.LANSAT: - return 'Raises critical hit ratio if HP is below 25%'; + return +i18next.t('berry:Raises_critical_hit_ratio_if_HP_is_below_25%'); case BerryType.STARF: - return 'Sharply raises a random stat if HP is below 25%'; + return +i18next.t('berry:Sharply_raises_a_random_stat_if_HP_is_below_25%'); case BerryType.LEPPA: - return 'Restores 10 PP to a move if its PP reaches 0'; + return +i18next.t('berry:Restores_10_PP_to_a_move_if_its_PP_reaches_0'); } } @@ -104,7 +104,7 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc { const hpHealed = new Utils.NumberHolder(Math.floor(pokemon.getMaxHp() / 4)); applyAbAttrs(DoubleBerryEffectAbAttr, pokemon, null, hpHealed); pokemon.scene.unshiftPhase(new PokemonHealPhase(pokemon.scene, pokemon.getBattlerIndex(), - hpHealed.value, getPokemonMessage(pokemon, `'s ${getBerryName(berryType)}\nrestored its HP!`), true)); + hpHealed.value, getPokemonMessage(pokemon, `'s ${getBerryName(berryType)}\n`+i18next.t('berry:restored_its_HP')), true)); }; case BerryType.LUM: return (pokemon: Pokemon) => { @@ -151,7 +151,7 @@ export function getBerryEffectFunc(berryType: BerryType): BerryEffectFunc { pokemon.battleData.berriesEaten.push(berryType); const ppRestoreMove = pokemon.getMoveset().find(m => !m.getPpRatio()); ppRestoreMove.ppUsed = Math.max(ppRestoreMove.ppUsed - 10, 0); - pokemon.scene.queueMessage(getPokemonMessage(pokemon, ` restored PP to its move ${ppRestoreMove.getName()}\nusing its ${getBerryName(berryType)}!`)); + pokemon.scene.queueMessage(getPokemonMessage(pokemon, `${i18next.t('berry:restored_PP_to_its_move')} ${ppRestoreMove.getName()}\n${i18next.t('berry:using_its')} ${getBerryName(berryType)}!`)); }; } } \ No newline at end of file diff --git a/src/locales/en/battle.ts b/src/locales/en/battle.ts index a6ed2fabc64..c2c6b551c35 100644 --- a/src/locales/en/battle.ts +++ b/src/locales/en/battle.ts @@ -52,5 +52,20 @@ export const battle: SimpleTranslationEntries = { "notDisabled": "{{pokemonName}}'s {{moveName}} is disabled\nno more!", "skipItemQuestion": "Are you sure you want to skip taking an item?", "eggHatching": "Oh?", - "ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?" + "ivScannerUseQuestion": "Use IV Scanner on {{pokemonName}}?", + "Attack": "Attack", + "Defense": "Defense", + "Sp_Atk": "Sp. Atk", + "Sp_Def": "Sp. Def", + "Speed": "Speed", + "Accuracy": "Accuracy", + "Evasiveness": "Evasiveness", + "rose": "rose", + "sharply_rose": "sharply_rose", + "rose_drastically": "rose drastically", + "fell": "fell", + "harshly_fell": "harshly fell", + "severly_fell": "severly fell", + "won_t_go_any_higher": "won\'t go any higher", + "won_t_go_any_lower": "won\'t go any lower" } as const; \ No newline at end of file diff --git a/src/locales/en/berry.ts b/src/locales/en/berry.ts new file mode 100644 index 00000000000..2a3327eec3d --- /dev/null +++ b/src/locales/en/berry.ts @@ -0,0 +1,16 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const berry: SimpleTranslationEntries = { + "Restores_25%_HP_if_HP_is_below_50%": "Restores 25% HP if HP is below 50%", + "Cures_any_non-volatile_status_condition_and_confusion": "Cures any non-volatile status condition and confusion", + "Restores_25%_HP_if_hit_by_a_super_effective_move": "Restores 25% HP if hit by a super effective move", + "Raises": "Raises", + "if_HP_is_below_25%": "if HP is below 25%", + "Raises_critical_hit_ratio_if_HP_is_below_25%": "Raises critical hit ratio if HP is below 25%", + "Sharply_raises_a_random_stat_if_HP_is_below_25%": "Sharply raises a random stat if HP is below 25%", + "Restores_10_PP_to_a_move_if_its_PP_reaches_0": "Restores 10 PP to a move if its PP reaches 0", + "restored_PP_to_its_move": "restored PP to its move", + "using_its": "using its", + "restored_its_HP":"restored its HP!", + "Berry": "Berry" +} as const; \ No newline at end of file diff --git a/src/locales/en/config.ts b/src/locales/en/config.ts index a5d207da932..c7c54a14cd7 100644 --- a/src/locales/en/config.ts +++ b/src/locales/en/config.ts @@ -18,7 +18,7 @@ import { tutorial } from "./tutorial"; import { titles,trainerClasses,trainerNames } from "./trainers"; import { splashMessages } from "./splash-messages" import { weather } from "./weather"; - +import { berry } from "./berry"; export const enConfig = { ability: ability, @@ -43,4 +43,5 @@ export const enConfig = { growth: growth, weather: weather, modifierType: modifierType, + berry:berry, } diff --git a/src/locales/zh_CN/battle.ts b/src/locales/zh_CN/battle.ts index cf58add1d6d..85b669c9486 100644 --- a/src/locales/zh_CN/battle.ts +++ b/src/locales/zh_CN/battle.ts @@ -19,7 +19,7 @@ export const battle: SimpleTranslationEntries = { "hitResultSuperEffective": "效果拔群!", "hitResultNotVeryEffective": "收效甚微…", "hitResultNoEffect": "对 {{pokemonName}} 没有效果!!", - "hitResultOneHitKO": "一击必杀!", + "hitResultOneHitKO": "一击必杀!", "attackFailed": "但是失败了!", "attackHitsCount": `击中 {{count}} 次!`, "expGain": "{{pokemonName}} 获得了 {{exp}} 经验值!", @@ -52,5 +52,20 @@ export const battle: SimpleTranslationEntries = { "notDisabled": "{{moveName}} 不再被禁用!", "skipItemQuestion": "你确定要跳过拾取道具吗?", "eggHatching": "咦?", - "ivScannerUseQuestion": "对 {{pokemonName}} 使用个体值扫描仪?" + "ivScannerUseQuestion": "对 {{pokemonName}} 使用个体值扫描仪?", + "Attack": "攻击(ATK)", + "Defense": "防御(DEF)", + "Sp_Atk": "特殊攻击(SP ATK)", + "Sp_Def": "特殊防御(SP DEF)", + "Speed": "速度(SPD)", + "Accuracy": "准度(ACC)", + "Evasiveness": "闪避(EVA)", + "rose": "小幅上升", + "sharply_rose": "大幅上升", + "rose_drastically": "显著上升", + "fell": "小幅降低", + "harshly_fell": "大幅降低", + "severly_fell": "显著降低", + "won_t_go_any_higher": "不能再增加", + "won_t_go_any_lower": "不能再减少" } as const; \ No newline at end of file diff --git a/src/locales/zh_CN/berry.ts b/src/locales/zh_CN/berry.ts new file mode 100644 index 00000000000..ce69bb886d3 --- /dev/null +++ b/src/locales/zh_CN/berry.ts @@ -0,0 +1,17 @@ +import { SimpleTranslationEntries } from "#app/plugins/i18n"; + +export const berry: SimpleTranslationEntries = { + "Restores_25%_HP_if_HP_is_below_50%": "如果HP低于50%,恢复25%的HP", + "Cures_any_non-volatile_status_condition_and_confusion": "治愈任何非易失性状态异常和混乱状态", + "Restores_25%_HP_if_hit_by_a_super_effective_move": "如果受到超有效的攻击,恢复25%的HP", + "Raises": "提升", + "if_HP_is_below_25%": ",在HP低于25%的情况下", + "Raises_critical_hit_ratio_if_HP_is_below_25%": "如果HP低于25%,提升击中要害的概率", + "Sharply_raises_a_random_stat_if_HP_is_below_25%": "如果HP低于25%,大幅提升一项随机能力值", + "Restores_10_PP_to_a_move_if_its_PP_reaches_0": "如果技能的PP降至0,恢复10点PP", + "restored_PP_to_its_move": "恢复了招式的PP", + "using_its": "使用", + "restored_its_HP":"恢复了HP!", + "Berry": "浆果" + +} as const; \ No newline at end of file diff --git a/src/locales/zh_CN/config.ts b/src/locales/zh_CN/config.ts index 957b1e7a482..77f18f73902 100644 --- a/src/locales/zh_CN/config.ts +++ b/src/locales/zh_CN/config.ts @@ -11,12 +11,12 @@ import { pokemon } from "./pokemon"; import { pokemonStat } from "./pokemon-stat"; import { starterSelectUiHandler } from "./starter-select-ui-handler"; import { tutorial } from "./tutorial"; -import { titles,trainerClasses,trainerNames } from "./trainers"; +import { titles, trainerClasses, trainerNames } from "./trainers"; import { nature } from "./nature"; import { weather } from "./weather"; import { modifierType } from "./modifier-type"; import { growth } from "./growth"; - +import { berry } from "./berry"; export const zhCnConfig = { ability: ability, @@ -36,8 +36,8 @@ export const zhCnConfig = { trainerClasses: trainerClasses, trainerNames: trainerNames, tutorial: tutorial, - nature: nature, growth: growth, weather: weather, modifierType: modifierType, + berry: berry } diff --git a/src/plugins/i18n.ts b/src/plugins/i18n.ts index 807e1a1b550..b8e188e9fe3 100644 --- a/src/plugins/i18n.ts +++ b/src/plugins/i18n.ts @@ -82,7 +82,7 @@ export function initI18n(): void { i18next.use(LanguageDetector).init({ lng: lang, fallbackLng: 'en', - supportedLngs: ['en', 'es', 'fr', 'it', 'de', 'zh_CN','pt_BR'], + supportedLngs: ['en', 'es', 'fr', 'it', 'de', 'zh_CN', 'pt_BR'], debug: true, interpolation: { escapeValue: false, @@ -139,6 +139,7 @@ declare module 'i18next' { egg: SimpleTranslationEntries; weather: SimpleTranslationEntries; modifierType: ModifierTypeTranslationEntries; + berry: SimpleTranslationEntries; }; } }