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 * as Utils from "../utils";
import { DoubleBerryEffectAbAttr, ReduceBerryUseThresholdAbAttr, applyAbAttrs } from "./ability";
import i18next from '../plugins/i18n';
export enum BerryType {
SITRUS,
@ -22,32 +23,12 @@ export enum BerryType {
LEPPA
}
export function getBerryName(berryType: BerryType) {
return `${Utils.toReadableString(BerryType[berryType])} Berry`;
export function getBerryName(berryType: BerryType): string {
return i18next.t(`berry:${BerryType[berryType]}.name`);
}
export function getBerryEffectDescription(berryType: BerryType) {
switch (berryType) {
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 function getBerryEffectDescription(berryType: BerryType): string {
return i18next.t(`berry:${BerryType[berryType]}.effect`);
}
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 { tutorial } from "./tutorial";
import { weather } from "./weather";
import { berry } from "./berry";
export const deConfig = {
@ -43,4 +44,5 @@ export const deConfig = {
trainerNames: trainerNames,
tutorial: tutorial,
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 { tutorial } from "./tutorial";
import { weather } from "./weather";
import { berry } from "./berry";
export const enConfig = {
ability: ability,
@ -42,4 +44,5 @@ export const enConfig = {
trainerNames: trainerNames,
tutorial: tutorial,
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 { tutorial } from "./tutorial";
import { weather } from "./weather";
import { berry } from "./berry";
export const esConfig = {
@ -43,4 +44,5 @@ export const esConfig = {
trainerNames: trainerNames,
tutorial: tutorial,
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 { tutorial } from "./tutorial";
import { weather } from "./weather";
import { berry } from "./berry";
export const frConfig = {
@ -43,5 +44,6 @@ export const frConfig = {
trainerNames: trainerNames,
tutorial: tutorial,
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 { tutorial } from "./tutorial";
import { weather } from "./weather";
import { berry } from "./berry";
export const itConfig = {
@ -43,4 +44,5 @@ export const itConfig = {
trainerNames: trainerNames,
tutorial: tutorial,
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 { tutorial } from "./tutorial";
import { weather } from "./weather";
import { berry } from "./berry";
export const ptBrConfig = {
@ -33,4 +34,5 @@ export const ptBrConfig = {
growth: growth,
weather: weather,
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 { tutorial } from "./tutorial";
import { weather } from "./weather";
import { berry } from "./berry";
export const zhCnConfig = {
@ -43,4 +44,5 @@ export const zhCnConfig = {
trainerNames: trainerNames,
tutorial: tutorial,
weather: weather,
berry: berry,
}

View File

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