Hi,
I'm having a lot of fun learning Javascript using Pok茅api, so first thank you for that !
I've created a pokedex (in french), and i'm using [flavor_text_entries] to get the pokemon's description. So in https://pokeapi.co/api/v2/pokemon-species/1 I'm getting [flavor_text_entries][5][flavor_text] to have the french description of the pokemon. In this case (for bulbasaur) I indeed have the french description. But for Starmie for example (id 121), [flavor_text_entries][5][flavor_text] return the description in German.
So I've tested on several pokemon, and it happens that some have a french description and some have a german one. How can I fix that to always have the french one ? Cheers !
As a workaround loop through the flavor text entries and just select those which have ['language']['name']=='fr'
That's what I did.
Oh right didn't think about it, thank you !
Actually there are many inconsistencies in the data and you just need a little programming to find your way around them.
flavor_text doe not guarantee that text for a certain language will always be at the same index of the list.
You should always check the language name field for the language you want, as @HybridShivam explained.
You can check the documentation for more information.