Implements localization for BerryType (#1007)

This commit is contained in:
FanHua 2024-05-17 18:09:08 +08:00 committed by GitHub
parent 61938869c1
commit 250142083a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 366 additions and 24 deletions

View File

@ -7,6 +7,7 @@ import { BattlerTagType } from "./enums/battler-tag-type";
import { getStatusEffectHealText } from "./status-effect"; import { getStatusEffectHealText } from "./status-effect";
import * as Utils from "../utils"; import * as Utils from "../utils";
import { DoubleBerryEffectAbAttr, ReduceBerryUseThresholdAbAttr, applyAbAttrs } from "./ability"; import { DoubleBerryEffectAbAttr, ReduceBerryUseThresholdAbAttr, applyAbAttrs } from "./ability";
import i18next from '../plugins/i18n';
export enum BerryType { export enum BerryType {
SITRUS, SITRUS,
@ -22,32 +23,12 @@ export enum BerryType {
LEPPA LEPPA
} }
export function getBerryName(berryType: BerryType) { export function getBerryName(berryType: BerryType): string {
return `${Utils.toReadableString(BerryType[berryType])} Berry`; return i18next.t(`berry:${BerryType[berryType]}.name`);
} }
export function getBerryEffectDescription(berryType: BerryType) { export function getBerryEffectDescription(berryType: BerryType): string {
switch (berryType) { return i18next.t(`berry:${BerryType[berryType]}.effect`);
case BerryType.SITRUS:
return 'Restores 25% HP if HP is below 50%';
case BerryType.LUM:
return 'Cures any non-volatile status condition and confusion';
case BerryType.ENIGMA:
return '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%`;
case BerryType.LANSAT:
return 'Raises critical hit ratio if HP is below 25%';
case BerryType.STARF:
return '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';
}
} }
export type BerryPredicate = (pokemon: Pokemon) => boolean; export type BerryPredicate = (pokemon: Pokemon) => boolean;

48
src/locales/de/berry.ts Normal file
View File

@ -0,0 +1,48 @@
import { BerryTranslationEntries } from "#app/plugins/i18n";
export const berry: BerryTranslationEntries = {
"SITRUS": {
name: "Sitrus Berry",
effect: "Restores 25% HP if HP is below 50%",
},
"LUM": {
name: "Lum Berry",
effect: "Cures any non-volatile status condition and confusion",
},
"ENIGMA": {
name: "Enigma Berry",
effect: "Restores 25% HP if hit by a super effective move",
},
"LIECHI": {
name: "Liechi Berry",
effect: "Raises Attack if HP is below 25%",
},
"GANLON": {
name: "Ganlon Berry",
effect: "Raises Defense if HP is below 25%",
},
"PETAYA": {
name: "Petaya Berry",
effect: "Raises Sp. Atk if HP is below 25%",
},
"APICOT": {
name: "Apicot Berry",
effect: "Raises Sp. Def if HP is below 25%",
},
"SALAC": {
name: "Salac Berry",
effect: "Raises Speed if HP is below 25%",
},
"LANSAT": {
name: "Lansat Berry",
effect: "Raises critical hit ratio if HP is below 25%",
},
"STARF": {
name: "Starf Berry",
effect: "Sharply raises a random stat if HP is below 25%",
},
"LEPPA": {
name: "Leppa Berry",
effect: "Restores 10 PP to a move if its PP reaches 0",
},
} as const;

View File

@ -18,6 +18,7 @@ import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { titles, trainerClasses, trainerNames } from "./trainers"; import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial"; import { tutorial } from "./tutorial";
import { weather } from "./weather"; import { weather } from "./weather";
import { berry } from "./berry";
export const deConfig = { export const deConfig = {
@ -43,4 +44,5 @@ export const deConfig = {
trainerNames: trainerNames, trainerNames: trainerNames,
tutorial: tutorial, tutorial: tutorial,
weather: weather, weather: weather,
berry: berry,
} }

48
src/locales/en/berry.ts Normal file
View File

@ -0,0 +1,48 @@
import { BerryTranslationEntries } from "#app/plugins/i18n";
export const berry: BerryTranslationEntries = {
"SITRUS": {
name: "Sitrus Berry",
effect: "Restores 25% HP if HP is below 50%",
},
"LUM": {
name: "Lum Berry",
effect: "Cures any non-volatile status condition and confusion",
},
"ENIGMA": {
name: "Enigma Berry",
effect: "Restores 25% HP if hit by a super effective move",
},
"LIECHI": {
name: "Liechi Berry",
effect: "Raises Attack if HP is below 25%",
},
"GANLON": {
name: "Ganlon Berry",
effect: "Raises Defense if HP is below 25%",
},
"PETAYA": {
name: "Petaya Berry",
effect: "Raises Sp. Atk if HP is below 25%",
},
"APICOT": {
name: "Apicot Berry",
effect: "Raises Sp. Def if HP is below 25%",
},
"SALAC": {
name: "Salac Berry",
effect: "Raises Speed if HP is below 25%",
},
"LANSAT": {
name: "Lansat Berry",
effect: "Raises critical hit ratio if HP is below 25%",
},
"STARF": {
name: "Starf Berry",
effect: "Sharply raises a random stat if HP is below 25%",
},
"LEPPA": {
name: "Leppa Berry",
effect: "Restores 10 PP to a move if its PP reaches 0",
},
} as const;

View File

@ -18,6 +18,8 @@ import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { titles, trainerClasses, trainerNames } from "./trainers"; import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial"; import { tutorial } from "./tutorial";
import { weather } from "./weather"; import { weather } from "./weather";
import { berry } from "./berry";
export const enConfig = { export const enConfig = {
ability: ability, ability: ability,
@ -42,4 +44,5 @@ export const enConfig = {
trainerNames: trainerNames, trainerNames: trainerNames,
tutorial: tutorial, tutorial: tutorial,
weather: weather, weather: weather,
berry: berry,
} }

48
src/locales/es/berry.ts Normal file
View File

@ -0,0 +1,48 @@
import { BerryTranslationEntries } from "#app/plugins/i18n";
export const berry: BerryTranslationEntries = {
"SITRUS": {
name: "Sitrus Berry",
effect: "Restores 25% HP if HP is below 50%",
},
"LUM": {
name: "Lum Berry",
effect: "Cures any non-volatile status condition and confusion",
},
"ENIGMA": {
name: "Enigma Berry",
effect: "Restores 25% HP if hit by a super effective move",
},
"LIECHI": {
name: "Liechi Berry",
effect: "Raises Attack if HP is below 25%",
},
"GANLON": {
name: "Ganlon Berry",
effect: "Raises Defense if HP is below 25%",
},
"PETAYA": {
name: "Petaya Berry",
effect: "Raises Sp. Atk if HP is below 25%",
},
"APICOT": {
name: "Apicot Berry",
effect: "Raises Sp. Def if HP is below 25%",
},
"SALAC": {
name: "Salac Berry",
effect: "Raises Speed if HP is below 25%",
},
"LANSAT": {
name: "Lansat Berry",
effect: "Raises critical hit ratio if HP is below 25%",
},
"STARF": {
name: "Starf Berry",
effect: "Sharply raises a random stat if HP is below 25%",
},
"LEPPA": {
name: "Leppa Berry",
effect: "Restores 10 PP to a move if its PP reaches 0",
},
} as const;

View File

@ -18,6 +18,7 @@ import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { titles, trainerClasses, trainerNames } from "./trainers"; import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial"; import { tutorial } from "./tutorial";
import { weather } from "./weather"; import { weather } from "./weather";
import { berry } from "./berry";
export const esConfig = { export const esConfig = {
@ -43,4 +44,5 @@ export const esConfig = {
trainerNames: trainerNames, trainerNames: trainerNames,
tutorial: tutorial, tutorial: tutorial,
weather: weather, weather: weather,
berry: berry,
} }

48
src/locales/fr/berry.ts Normal file
View File

@ -0,0 +1,48 @@
import { BerryTranslationEntries } from "#app/plugins/i18n";
export const berry: BerryTranslationEntries = {
"SITRUS": {
name: "Sitrus Berry",
effect: "Restores 25% HP if HP is below 50%",
},
"LUM": {
name: "Lum Berry",
effect: "Cures any non-volatile status condition and confusion",
},
"ENIGMA": {
name: "Enigma Berry",
effect: "Restores 25% HP if hit by a super effective move",
},
"LIECHI": {
name: "Liechi Berry",
effect: "Raises Attack if HP is below 25%",
},
"GANLON": {
name: "Ganlon Berry",
effect: "Raises Defense if HP is below 25%",
},
"PETAYA": {
name: "Petaya Berry",
effect: "Raises Sp. Atk if HP is below 25%",
},
"APICOT": {
name: "Apicot Berry",
effect: "Raises Sp. Def if HP is below 25%",
},
"SALAC": {
name: "Salac Berry",
effect: "Raises Speed if HP is below 25%",
},
"LANSAT": {
name: "Lansat Berry",
effect: "Raises critical hit ratio if HP is below 25%",
},
"STARF": {
name: "Starf Berry",
effect: "Sharply raises a random stat if HP is below 25%",
},
"LEPPA": {
name: "Leppa Berry",
effect: "Restores 10 PP to a move if its PP reaches 0",
},
} as const;

View File

@ -18,6 +18,7 @@ import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { titles, trainerClasses, trainerNames } from "./trainers"; import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial"; import { tutorial } from "./tutorial";
import { weather } from "./weather"; import { weather } from "./weather";
import { berry } from "./berry";
export const frConfig = { export const frConfig = {
@ -43,5 +44,6 @@ export const frConfig = {
trainerNames: trainerNames, trainerNames: trainerNames,
tutorial: tutorial, tutorial: tutorial,
weather: weather, weather: weather,
berry: berry,
} }

48
src/locales/it/berry.ts Normal file
View File

@ -0,0 +1,48 @@
import { BerryTranslationEntries } from "#app/plugins/i18n";
export const berry: BerryTranslationEntries = {
"SITRUS": {
name: "Sitrus Berry",
effect: "Restores 25% HP if HP is below 50%",
},
"LUM": {
name: "Lum Berry",
effect: "Cures any non-volatile status condition and confusion",
},
"ENIGMA": {
name: "Enigma Berry",
effect: "Restores 25% HP if hit by a super effective move",
},
"LIECHI": {
name: "Liechi Berry",
effect: "Raises Attack if HP is below 25%",
},
"GANLON": {
name: "Ganlon Berry",
effect: "Raises Defense if HP is below 25%",
},
"PETAYA": {
name: "Petaya Berry",
effect: "Raises Sp. Atk if HP is below 25%",
},
"APICOT": {
name: "Apicot Berry",
effect: "Raises Sp. Def if HP is below 25%",
},
"SALAC": {
name: "Salac Berry",
effect: "Raises Speed if HP is below 25%",
},
"LANSAT": {
name: "Lansat Berry",
effect: "Raises critical hit ratio if HP is below 25%",
},
"STARF": {
name: "Starf Berry",
effect: "Sharply raises a random stat if HP is below 25%",
},
"LEPPA": {
name: "Leppa Berry",
effect: "Restores 10 PP to a move if its PP reaches 0",
},
} as const;

View File

@ -18,6 +18,7 @@ import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { titles, trainerClasses, trainerNames } from "./trainers"; import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial"; import { tutorial } from "./tutorial";
import { weather } from "./weather"; import { weather } from "./weather";
import { berry } from "./berry";
export const itConfig = { export const itConfig = {
@ -43,4 +44,5 @@ export const itConfig = {
trainerNames: trainerNames, trainerNames: trainerNames,
tutorial: tutorial, tutorial: tutorial,
weather: weather, weather: weather,
berry: berry,
} }

View File

@ -0,0 +1,48 @@
import { BerryTranslationEntries } from "#app/plugins/i18n";
export const berry: BerryTranslationEntries = {
"SITRUS": {
name: "Sitrus Berry",
effect: "Restores 25% HP if HP is below 50%",
},
"LUM": {
name: "Lum Berry",
effect: "Cures any non-volatile status condition and confusion",
},
"ENIGMA": {
name: "Enigma Berry",
effect: "Restores 25% HP if hit by a super effective move",
},
"LIECHI": {
name: "Liechi Berry",
effect: "Raises Attack if HP is below 25%",
},
"GANLON": {
name: "Ganlon Berry",
effect: "Raises Defense if HP is below 25%",
},
"PETAYA": {
name: "Petaya Berry",
effect: "Raises Sp. Atk if HP is below 25%",
},
"APICOT": {
name: "Apicot Berry",
effect: "Raises Sp. Def if HP is below 25%",
},
"SALAC": {
name: "Salac Berry",
effect: "Raises Speed if HP is below 25%",
},
"LANSAT": {
name: "Lansat Berry",
effect: "Raises critical hit ratio if HP is below 25%",
},
"STARF": {
name: "Starf Berry",
effect: "Sharply raises a random stat if HP is below 25%",
},
"LEPPA": {
name: "Leppa Berry",
effect: "Restores 10 PP to a move if its PP reaches 0",
},
} as const;

View File

@ -14,6 +14,7 @@ import { pokemonStat } from "./pokemon-stat";
import { starterSelectUiHandler } from "./starter-select-ui-handler"; import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { tutorial } from "./tutorial"; import { tutorial } from "./tutorial";
import { weather } from "./weather"; import { weather } from "./weather";
import { berry } from "./berry";
export const ptBrConfig = { export const ptBrConfig = {
@ -33,4 +34,5 @@ export const ptBrConfig = {
growth: growth, growth: growth,
weather: weather, weather: weather,
modifierType: modifierType, modifierType: modifierType,
berry: berry,
} }

View File

@ -0,0 +1,48 @@
import { BerryTranslationEntries } from "#app/plugins/i18n";
export const berry: BerryTranslationEntries = {
"SITRUS": {
name: "Sitrus Berry",
effect: "Restores 25% HP if HP is below 50%",
},
"LUM": {
name: "Lum Berry",
effect: "Cures any non-volatile status condition and confusion",
},
"ENIGMA": {
name: "Enigma Berry",
effect: "Restores 25% HP if hit by a super effective move",
},
"LIECHI": {
name: "Liechi Berry",
effect: "Raises Attack if HP is below 25%",
},
"GANLON": {
name: "Ganlon Berry",
effect: "Raises Defense if HP is below 25%",
},
"PETAYA": {
name: "Petaya Berry",
effect: "Raises Sp. Atk if HP is below 25%",
},
"APICOT": {
name: "Apicot Berry",
effect: "Raises Sp. Def if HP is below 25%",
},
"SALAC": {
name: "Salac Berry",
effect: "Raises Speed if HP is below 25%",
},
"LANSAT": {
name: "Lansat Berry",
effect: "Raises critical hit ratio if HP is below 25%",
},
"STARF": {
name: "Starf Berry",
effect: "Sharply raises a random stat if HP is below 25%",
},
"LEPPA": {
name: "Leppa Berry",
effect: "Restores 10 PP to a move if its PP reaches 0",
},
} as const;

View File

@ -18,6 +18,7 @@ import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { titles, trainerClasses, trainerNames } from "./trainers"; import { titles, trainerClasses, trainerNames } from "./trainers";
import { tutorial } from "./tutorial"; import { tutorial } from "./tutorial";
import { weather } from "./weather"; import { weather } from "./weather";
import { berry } from "./berry";
export const zhCnConfig = { export const zhCnConfig = {
@ -43,4 +44,5 @@ export const zhCnConfig = {
trainerNames: trainerNames, trainerNames: trainerNames,
tutorial: tutorial, tutorial: tutorial,
weather: weather, weather: weather,
berry: berry,
} }

View File

@ -46,6 +46,15 @@ export interface ModifierTypeTranslationEntries {
TeraType: SimpleTranslationEntries, TeraType: SimpleTranslationEntries,
} }
export interface BerryTranslationEntry {
name: string,
effect: string
}
export interface BerryTranslationEntries {
[key: string]: BerryTranslationEntry
}
export interface Localizable { export interface Localizable {
localize(): void; localize(): void;
} }
@ -139,6 +148,7 @@ declare module 'i18next' {
egg: SimpleTranslationEntries; egg: SimpleTranslationEntries;
weather: SimpleTranslationEntries; weather: SimpleTranslationEntries;
modifierType: ModifierTypeTranslationEntries; modifierType: ModifierTypeTranslationEntries;
berry: BerryTranslationEntries;
}; };
} }
} }