1
0
mirror of https://github.com/tcgdex/cards-database.git synced 2025-04-23 11:22:10 +00:00
Florian Bouillon 4190dd8e27
Update interfaces
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
2020-02-08 00:41:23 +01:00

39 lines
598 B
TypeScript
Raw Blame History

enum Category {
POKEMON,
TRAINER,
ENERGY
}
const en = [
"Pokémon",
"Trainer",
"Energy"
]
const fr = [
"Pokémon",
"Dresseur",
"Énergie"
]
namespace Category {
export function fromEnglish(str: string) {
let i = en.indexOf(str)
if (str === "Pok<6F><6B>mon") i = 1
if (i < 0) throw new Error(`Cannot get the category (${str})`)
return i
}
export function toLang(i: Category, lang: string): string {
switch (lang) {
case "en":
return en[i]
case "fr":
return fr[i]
}
throw new Error(`Error, Language not implemented! (${lang})`)
}
}
export default Category