Removed Translation functions

Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-04-29 11:15:16 +02:00
parent d4bfb0f6d6
commit 20613a0b49
2 changed files with 4 additions and 17 deletions

View File

@ -2,7 +2,7 @@ import { setToSetSimple } from "./setUtil"
import { fetchRemoteFile, smartGlob } from "./util"
import { Set, SupportedLanguages, Card, Types } from 'db/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>>
@ -62,7 +62,7 @@ export async function cardToCardSingle(localId: string, card: Card, lang: Suppor
dexId: card.dexId,
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],
weight: card.weight,
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) => ({
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,
effect: el.effect ? el.effect[lang] : undefined,
damage: el.damage

View File

@ -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'
@ -86,16 +86,3 @@ export default function translate(item: translatable, key: string | undefined, l
}
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)
}