pokeapi icon indicating copy to clipboard operation
pokeapi copied to clipboard

Search Pokemon with other language

Open MTRNord opened this issue 10 years ago • 10 comments

We/I have the Problem that the Api only uses english (I think) names for the endpoints of "api/v2/pokemon/{name}/" but I (and others in a chat where I use the API) only learned the german names. Is there a way to call the API with german names or to "auto-translate" it correct?

MTRNord avatar Jul 15 '16 19:07 MTRNord

No, that functionality doesn't exist. Your best bet is to call by id instead. The full object contains translated names.

On Fri, Jul 15, 2016, 3:50 PM Marcel [email protected] wrote:

We/I have the Problem that the Api only uses english (I think) names for the endpoints of "api/v2/pokemon/{name}/" but I (and others in a chat where I use the API) only learned the german names. Is there a way to call the API with german names or to "auto-translate" it correct?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/PokeAPI/pokeapi/issues/235, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQlpbKWitG9mbtMPv3r0Kr7FG0-W_Rvks5qV-SZgaJpZM4JNuny .

sargunv avatar Jul 15 '16 19:07 sargunv

And is there a file where these translations are belongside the english ones? I have as idea that I could use the german names and "translate" it to an id or where do you get the translations from?

MTRNord avatar Jul 15 '16 19:07 MTRNord

https://github.com/PokeAPI/pokeapi/blob/master/data/v2/csv/pokemon_species_names.csv

I believe German is language id 6.

sargunv avatar Jul 15 '16 19:07 sargunv

Ok than I write and thingy that searches the german name in that file and gets that ID. If you want you can close the issue :)

MTRNord avatar Jul 15 '16 20:07 MTRNord

I've made the proposal #236 to cover use cases like this. Go ahead and follow that if you're interested.

sargunv avatar Jul 15 '16 20:07 sargunv

@MTRNord # könntest du mir das mal erklären wie das funktioniert die Pokemon und den Pokedex auf Deutsch einzustellen? Ich verstehe die Computersprache nicht so wirklich. Das einzige was ich bis jetzt geschafft habe ist das man nun die Texte auf dDeutsch hat wenn man es gefangen hat ect.

GladiusBlack avatar Jun 18 '21 15:06 GladiusBlack

@MTRNord did you come up with something?

Davidwalser avatar Dec 17 '22 19:12 Davidwalser

@MTRNord did you come up with something?

I don't even remember having opened this issue 6 years ago :D so I also don't remember where I used it or how I used it. Sorry 😅

MTRNord avatar Dec 17 '22 19:12 MTRNord

@MTRNord all good :) the api is kinda frustrating tho not offering proper language support :(

Davidwalser avatar Dec 17 '22 20:12 Davidwalser

@Davidwalser here you go:

query searchForPokemonInGerman {
  pokemon_v2_pokemonspecies(
    where: {
      pokemon_v2_pokemonspeciesnames: {
        pokemon_v2_language: { name: { _eq: "de" } }
        name: { _regex: "Ento.*" }
      }
    }
  ) {
    pokemon_v2_pokemonspeciesnames(
      where: { pokemon_v2_language: { name: { _eq: "de" } } }
    ) {
      name
    }
    id
  }
}

I used GraphQL. If you want you can insert two variables (language_name and pokemon_name_in_the_specified_language) and use the native GQL functionality to form a GQL query. Or use the above and substitute "de" with your language and "Ento* with your pokemon name.

Btw, Enton and Entoron are Psyduck and Golduck in German.

Naramsim avatar Jan 13 '23 11:01 Naramsim