Based off a previous Rust package I wrote, which itself is based off an npm package by Sindre Sorhous.
gleam add pokemon_names@1import pokemon_namesPokémon contain the following properties
pub type Pokemon {
Pokemon(species_id: Int, language_id: Int, name: String, genus: String)
}Returns all Pokémon from the dataset across all languages.
let all = pokemon_names.get_all()
io.println("Loaded " <> int.to_string(list.length(all)) <> " Pokémon")Returns all Pokémon in a specific language.
let english_pokemon = pokemon_names.get_all_with_lang(pokemon_names.English)Get a specific Pokémon by species ID and language.
pokemon_names.get_pokemon(25, pokemon_names.English)
// -> Ok(Pokemon(25, 9, "Pikachu", "Mouse Pokémon"))Get a random Pokémon from the entire dataset (any language).
Get a random Pokémon in a specific language.
pokemon_names.get_random_with_lang(pokemon_names.Japanese)
// -> Ok(Pokemon(143, 1, "カビゴン", "いねむりポケモン"))Get the English name of a Pokémon by species ID.
pokemon_names.get_name(6)
// -> Ok("Charizard")Get the name of a Pokémon by species ID in a specific language.
pokemon_names.get_name_with_lang(6, pokemon_names.English)
// -> Ok("Charizard")Get the numeric language ID for a language.
pokemon_names.language_id(pokemon_names.English)
// -> 9Supported languages for Pokémon names and genus text:
pub type Language {
Japanese // language_id: 1
JapaneseRomanized // language_id: 2
Korean // language_id: 3
Chinese // language_id: 4
French // language_id: 5
German // language_id: 6
Spanish // language_id: 7
Italian // language_id: 8
English // language_id: 9
}Run the codegen to regenerate embedded Pokémon data:
gleam run -m pokemon_names_dev