mirror of
https://github.com/tcgdex/compiler.git
synced 2025-04-22 10:42:09 +00:00
Removed Translation functions
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
This commit is contained in:
parent
d4bfb0f6d6
commit
20613a0b49
@ -2,7 +2,7 @@ import { setToSetSimple } from "./setUtil"
|
|||||||
import { fetchRemoteFile, smartGlob } from "./util"
|
import { fetchRemoteFile, smartGlob } from "./util"
|
||||||
import { Set, SupportedLanguages, Card, Types } from 'db/interfaces'
|
import { Set, SupportedLanguages, Card, Types } from 'db/interfaces'
|
||||||
import { Card as CardSingle, CardResume } from '@tcgdex/sdk/interfaces'
|
import { Card as CardSingle, CardResume } from '@tcgdex/sdk/interfaces'
|
||||||
import translate, { translateType } from './translationUtil'
|
import translate from './translationUtil'
|
||||||
|
|
||||||
type ObjectList<T = any> = Partial<Record<string, T>>
|
type ObjectList<T = any> = Partial<Record<string, T>>
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ export async function cardToCardSingle(localId: string, card: Card, lang: Suppor
|
|||||||
|
|
||||||
dexId: card.dexId,
|
dexId: card.dexId,
|
||||||
hp: card.hp,
|
hp: card.hp,
|
||||||
types: card.types?.map((t) => translateType(t, lang)) as Array<Types>,
|
types: card.types?.map((t) => translate('types', t, lang)) as Array<Types>,
|
||||||
evolveFrom: card.evolveFrom && card.evolveFrom[lang],
|
evolveFrom: card.evolveFrom && card.evolveFrom[lang],
|
||||||
weight: card.weight,
|
weight: card.weight,
|
||||||
description: card.description ? card.description[lang] as string : undefined,
|
description: card.description ? card.description[lang] as string : undefined,
|
||||||
@ -81,7 +81,7 @@ export async function cardToCardSingle(localId: string, card: Card, lang: Suppor
|
|||||||
})),
|
})),
|
||||||
|
|
||||||
attacks: card.attacks?.map((el) => ({
|
attacks: card.attacks?.map((el) => ({
|
||||||
cost: el.cost?.map((t) => translateType(t, lang)) as Types[],
|
cost: el.cost?.map((t) => translate('types', t, lang)) as Types[],
|
||||||
name: el.name[lang] as string,
|
name: el.name[lang] as string,
|
||||||
effect: el.effect ? el.effect[lang] : undefined,
|
effect: el.effect ? el.effect[lang] : undefined,
|
||||||
damage: el.damage
|
damage: el.damage
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { SupportedLanguages, Types } from 'db/interfaces'
|
import { SupportedLanguages } from 'db/interfaces'
|
||||||
|
|
||||||
type translatable = 'types' | 'rarity' | 'stage' | 'category' | 'suffix' | 'abilityType' | 'trainerType' | 'energyType'
|
type translatable = 'types' | 'rarity' | 'stage' | 'category' | 'suffix' | 'abilityType' | 'trainerType' | 'energyType'
|
||||||
|
|
||||||
@ -86,16 +86,3 @@ export default function translate(item: translatable, key: string | undefined, l
|
|||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
export function translateType(type: Types, lang: SupportedLanguages) {
|
|
||||||
return translate('types', type, lang)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export function translateStage(stage: string, lang: SupportedLanguages) {
|
|
||||||
return translate('stage', stage, lang)
|
|
||||||
}
|
|
||||||
|
|
||||||
export function translateRarity(rarity: string, lang: SupportedLanguages) {
|
|
||||||
return translate('rarity', rarity, lang)
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user