I18n import cleanup (#562)

* config import change

* all other configs
pull/564/head
Matthew 2024-05-06 14:25:17 -04:00 committed by GitHub
parent 009d538ac5
commit 674b2257be
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 162 additions and 143 deletions

28
src/locales/de/config.ts Normal file
View File

@ -0,0 +1,28 @@
import { ability } from "./ability";
import { battle } from "./battle";
import { commandUiHandler } from "./command-ui-handler";
import { fightUiHandler } from "./fight-ui-handler";
import { menu } from "./menu";
import { menuUiHandler } from "./menu-ui-handler";
import { move } from "./move";
import { pokeball } from "./pokeball";
import { pokemon } from "./pokemon";
import { pokemonStat } from "./pokemon-stat";
import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { tutorial } from "./tutorial";
export const deConfig = {
ability: ability,
battle: battle,
commandUiHandler: commandUiHandler,
fightUiHandler: fightUiHandler,
menuUiHandler: menuUiHandler,
menu: menu,
move: move,
pokeball: pokeball,
pokemonStat: pokemonStat,
pokemon: pokemon,
starterSelectUiHandler: starterSelectUiHandler,
tutorial: tutorial
}

28
src/locales/en/config.ts Normal file
View File

@ -0,0 +1,28 @@
import { ability } from "./ability";
import { battle } from "./battle";
import { commandUiHandler } from "./command-ui-handler";
import { fightUiHandler } from "./fight-ui-handler";
import { menu } from "./menu";
import { menuUiHandler } from "./menu-ui-handler";
import { move } from "./move";
import { pokeball } from "./pokeball";
import { pokemon } from "./pokemon";
import { pokemonStat } from "./pokemon-stat";
import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { tutorial } from "./tutorial";
export const enConfig = {
ability: ability,
battle: battle,
commandUiHandler: commandUiHandler,
fightUiHandler: fightUiHandler,
menuUiHandler: menuUiHandler,
menu: menu,
move: move,
pokeball: pokeball,
pokemonStat: pokemonStat,
pokemon: pokemon,
starterSelectUiHandler: starterSelectUiHandler,
tutorial: tutorial
}

28
src/locales/es/config.ts Normal file
View File

@ -0,0 +1,28 @@
import { ability } from "./ability";
import { battle } from "./battle";
import { commandUiHandler } from "./command-ui-handler";
import { fightUiHandler } from "./fight-ui-handler";
import { menu } from "./menu";
import { menuUiHandler } from "./menu-ui-handler";
import { move } from "./move";
import { pokeball } from "./pokeball";
import { pokemon } from "./pokemon";
import { pokemonStat } from "./pokemon-stat";
import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { tutorial } from "./tutorial";
export const esConfig = {
ability: ability,
battle: battle,
commandUiHandler: commandUiHandler,
fightUiHandler: fightUiHandler,
menuUiHandler: menuUiHandler,
menu: menu,
move: move,
pokeball: pokeball,
pokemonStat: pokemonStat,
pokemon: pokemon,
starterSelectUiHandler: starterSelectUiHandler,
tutorial: tutorial
}

28
src/locales/fr/config.ts Normal file
View File

@ -0,0 +1,28 @@
import { ability } from "./ability";
import { battle } from "./battle";
import { commandUiHandler } from "./command-ui-handler";
import { fightUiHandler } from "./fight-ui-handler";
import { menu } from "./menu";
import { menuUiHandler } from "./menu-ui-handler";
import { move } from "./move";
import { pokeball } from "./pokeball";
import { pokemon } from "./pokemon";
import { pokemonStat } from "./pokemon-stat";
import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { tutorial } from "./tutorial";
export const frConfig = {
ability: ability,
battle: battle,
commandUiHandler: commandUiHandler,
fightUiHandler: fightUiHandler,
menuUiHandler: menuUiHandler,
menu: menu,
move: move,
pokeball: pokeball,
pokemonStat: pokemonStat,
pokemon: pokemon,
starterSelectUiHandler: starterSelectUiHandler,
tutorial: tutorial
}

28
src/locales/it/config.ts Normal file
View File

@ -0,0 +1,28 @@
import { ability } from "./ability";
import { battle } from "./battle";
import { commandUiHandler } from "./command-ui-handler";
import { fightUiHandler } from "./fight-ui-handler";
import { menu } from "./menu";
import { menuUiHandler } from "./menu-ui-handler";
import { move } from "./move";
import { pokeball } from "./pokeball";
import { pokemon } from "./pokemon";
import { pokemonStat } from "./pokemon-stat";
import { starterSelectUiHandler } from "./starter-select-ui-handler";
import { tutorial } from "./tutorial";
export const itConfig = {
ability: ability,
battle: battle,
commandUiHandler: commandUiHandler,
fightUiHandler: fightUiHandler,
menuUiHandler: menuUiHandler,
menu: menu,
move: move,
pokeball: pokeball,
pokemonStat: pokemonStat,
pokemon: pokemon,
starterSelectUiHandler: starterSelectUiHandler,
tutorial: tutorial
}

View File

@ -1,77 +1,11 @@
import i18next from 'i18next'; import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector'; import LanguageDetector from 'i18next-browser-languagedetector';
import { menu as enMenu } from '../locales/en/menu'; import { deConfig } from '#app/locales/de/config.js';
import { menu as esMenu } from '../locales/es/menu'; import { enConfig } from '#app/locales/en/config.js';
import { menu as itMenu } from '../locales/it/menu'; import { esConfig } from '#app/locales/es/config.js';
import { menu as frMenu } from '../locales/fr/menu'; import { frConfig } from '#app/locales/fr/config.js';
import { menu as deMenu } from '../locales/de/menu'; import { itConfig } from '#app/locales/it/config.js';
import { menuUiHandler as enMenuUiHandler } from '../locales/en/menu-ui-handler.js';
import { menuUiHandler as esMenuUiHandler } from '../locales/es/menu-ui-handler.js';
import { menuUiHandler as frMenuUiHandler } from '../locales/fr/menu-ui-handler.js';
import { menuUiHandler as itMenuUiHandler } from '../locales/it/menu-ui-handler.js';
import { menuUiHandler as deMenuUiHandler } from '../locales/de/menu-ui-handler.js';
import { battle as enBattle } from '../locales/en/battle';
import { battle as esBattle } from '../locales/es/battle';
import { battle as itBattle } from '../locales/it/battle';
import { battle as frBattle } from '../locales/fr/battle';
import { battle as deBattle } from '../locales/de/battle';
import { move as enMove } from '../locales/en/move';
import { move as esMove } from '../locales/es/move';
import { move as itMove } from '../locales/it/move';
import { move as frMove } from '../locales/fr/move';
import { move as deMove } from '../locales/de/move';
import { ability as enAbility } from '../locales/en/ability';
import { ability as esAbility } from '../locales/es/ability';
import { ability as itAbility } from '../locales/it/ability';
import { ability as frAbility } from '../locales/fr/ability';
import { ability as deAbility } from '../locales/de/ability';
import { pokeball as enPokeball } from '../locales/en/pokeball';
import { pokeball as esPokeball } from '../locales/es/pokeball';
import { pokeball as itPokeball } from '../locales/it/pokeball';
import { pokeball as frPokeball } from '../locales/fr/pokeball';
import { pokeball as dePokeball } from '../locales/de/pokeball';
import { pokemon as enPokemon } from '../locales/en/pokemon';
import { pokemon as esPokemon } from '../locales/es/pokemon';
import { pokemon as itPokemon } from '../locales/it/pokemon';
import { pokemon as frPokemon } from '../locales/fr/pokemon';
import { pokemon as dePokemon } from '../locales/de/pokemon';
import { pokemonStat as enPokemonStat } from '../locales/en/pokemon-stat';
import { pokemonStat as esPokemonStat } from '../locales/es/pokemon-stat';
import { pokemonStat as frPokemonStat } from '../locales/fr/pokemon-stat';
import { pokemonStat as itPokemonStat } from '../locales/it/pokemon-stat';
import { pokemonStat as dePokemonStat } from '../locales/de/pokemon-stat';
import { commandUiHandler as enCommandUiHandler } from '../locales/en/command-ui-handler';
import { commandUiHandler as esCommandUiHandler } from '../locales/es/command-ui-handler';
import { commandUiHandler as itCommandUiHandler } from '../locales/it/command-ui-handler';
import { commandUiHandler as frCommandUiHandler } from '../locales/fr/command-ui-handler';
import { commandUiHandler as deCommandUiHandler } from '../locales/de/command-ui-handler';
import { fightUiHandler as enFightUiHandler } from '../locales/en/fight-ui-handler';
import { fightUiHandler as esFightUiHandler } from '../locales/es/fight-ui-handler';
import { fightUiHandler as frFightUiHandler } from '../locales/fr/fight-ui-handler';
import { fightUiHandler as itFightUiHandler } from '../locales/it/fight-ui-handler';
import { fightUiHandler as deFightUiHandler } from '../locales/de/fight-ui-handler';
import { tutorial as enTutorial } from '../locales/en/tutorial';
import { tutorial as esTutorial } from '../locales/es/tutorial';
import { tutorial as frTutorial } from '../locales/fr/tutorial';
import { tutorial as itTutorial} from '../locales/it/tutorial';
import { tutorial as deTutorial } from '../locales/de/tutorial';
import { starterSelectUiHandler as enStarterSelectUiHandler } from '../locales/en/starter-select-ui-handler';
import { starterSelectUiHandler as esStarterSelectUiHandler } from '../locales/es/starter-select-ui-handler';
import { starterSelectUiHandler as frStarterSelectUiHandler } from '../locales/fr/starter-select-ui-handler';
import { starterSelectUiHandler as itStarterSelectUiHandler} from '../locales/it/starter-select-ui-handler';
import { starterSelectUiHandler as deStarterSelectUiHandler } from '../locales/de/starter-select-ui-handler';
export interface SimpleTranslationEntries { export interface SimpleTranslationEntries {
[key: string]: string [key: string]: string
@ -131,74 +65,19 @@ export function initI18n(): void {
}, },
resources: { resources: {
en: { en: {
menu: enMenu, ...enConfig
menuUiHandler: enMenuUiHandler,
battle: enBattle,
move: enMove,
ability: enAbility,
pokeball: enPokeball,
pokemon: enPokemon,
pokemonStat: enPokemonStat,
commandUiHandler: enCommandUiHandler,
fightUiHandler: enFightUiHandler,
tutorial: enTutorial,
starterSelectUiHandler: enStarterSelectUiHandler
}, },
es: { es: {
menu: esMenu, ...esConfig
menuUiHandler: esMenuUiHandler,
battle: esBattle,
move: esMove,
ability: esAbility,
pokeball: esPokeball,
pokemon: esPokemon,
pokemonStat: esPokemonStat,
commandUiHandler: esCommandUiHandler,
fightUiHandler: esFightUiHandler,
tutorial: esTutorial,
starterSelectUiHandler: esStarterSelectUiHandler
}, },
fr: { fr: {
menu: frMenu, ...frConfig
menuUiHandler: frMenuUiHandler,
battle: frBattle,
move: frMove,
ability: frAbility,
pokeball: frPokeball,
pokemon: frPokemon,
pokemonStat: frPokemonStat,
commandUiHandler: frCommandUiHandler,
fightUiHandler: frFightUiHandler,
tutorial: frTutorial,
starterSelectUiHandler: frStarterSelectUiHandler
}, },
it: { it: {
menu: itMenu, ...itConfig
menuUiHandler: itMenuUiHandler,
battle: itBattle,
move: itMove,
ability: itAbility,
pokeball: itPokeball,
pokemon: itPokemon,
pokemonStat: itPokemonStat,
commandUiHandler: itCommandUiHandler,
fightUiHandler: itFightUiHandler,
tutorial: itTutorial,
starterSelectUiHandler: itStarterSelectUiHandler
}, },
de: { de: {
menu: deMenu, ...deConfig
menuUiHandler: deMenuUiHandler,
battle: deBattle,
move: deMove,
ability: deAbility,
pokeball: dePokeball,
pokemon: dePokemon,
pokemonStat: dePokemonStat,
commandUiHandler: deCommandUiHandler,
fightUiHandler: deFightUiHandler,
tutorial: deTutorial,
starterSelectUiHandler: deStarterSelectUiHandler
} }
}, },
}); });
@ -208,18 +87,18 @@ export function initI18n(): void {
declare module 'i18next' { declare module 'i18next' {
interface CustomTypeOptions { interface CustomTypeOptions {
resources: { resources: {
menu: typeof enMenu; menu: SimpleTranslationEntries;
menuUiHandler: typeof enMenuUiHandler; menuUiHandler: SimpleTranslationEntries;
move: typeof enMove; move: MoveTranslationEntries;
battle: typeof enBattle, battle: SimpleTranslationEntries,
ability: typeof enAbility; ability: AbilityTranslationEntries;
pokeball: typeof enPokeball; pokeball: SimpleTranslationEntries;
pokemon: typeof enPokemon; pokemon: SimpleTranslationEntries;
pokemonStat: typeof enPokemonStat; pokemonStat: SimpleTranslationEntries;
commandUiHandler: typeof enCommandUiHandler; commandUiHandler: SimpleTranslationEntries;
fightUiHandler: typeof enFightUiHandler; fightUiHandler: SimpleTranslationEntries;
tutorial: typeof enTutorial; tutorial: SimpleTranslationEntries;
starterSelectUiHandler: typeof enStarterSelectUiHandler; starterSelectUiHandler: SimpleTranslationEntries;
}; };
} }
} }