PokeAPI / pokeapi

The Pokémon API
https://pokeapi.co
BSD 3-Clause "New" or "Revised" License
4.17k stars 938 forks source link

Multi language / translation support #16

Closed phalt closed 8 years ago

phalt commented 9 years ago

Currently no ETA, but we'd like to add multi language support

bui commented 8 years ago

hi! I'm interested in this

what I thought would be best is an eg. locale object in each resource, something a little like this:

http://pokeapi.co/api/v1/pokemon/162/

{
    "name": "Furret",
    [...]
    "locale": {
        "Japanese": "オオタチ",
        "Official roomaji": "Ootachi",
        "Korean": "다꼬리",
        "Chinese": "大尾立",
        "French": "Fouinar",
        "German": "Wiesenior",
        "Spanish": "Furret",
        "Italian": "Furret"
    }
}

the language names are as they are defined by veekun: https://github.com/veekun/pokedex/blob/master/pokedex/data/csv/language_names.csv

is this okay?

zaneadix commented 8 years ago

Nice. Thanks for this @bui. We've done something similar to this so far in v2.

{
    "id": 162,
    "name": "furret",
    ...
    "names": [{
        "name": "Furret",
        "language": {
            "name": "en",
            "url": "http://localhost:8000/api/v2/language/9/"
        }
    }, {
        "name": "Wiesenior",
        "language": {
            "name": "de",
            "url": "http://localhost:8000/api/v2/language/6/"
        }
    }, {
        "name": "Fouinar",
        "language": {
            "name": "fr",
            "url": "http://localhost:8000/api/v2/language/5/"
        }
    }],
}

With the way the api is structured this is the cleanest way I was able to see organizing names. I've been thinking about possibly allowing a user to limit their returns (maybe they don't want every language). Not totally sure yet if that's something anyone would be concerned with though. Have any thoughts on whats going on here?

bui commented 8 years ago

@zaneadix that does look good! but what would be the purpose of those language resource URLs? and where do the language codes come from?

zaneadix commented 8 years ago

@bui Language will be a new resource. By codes I think you mean the short names like "fr" for "French"?

They come from the languages data in the Veekun database. https://github.com/veekun/pokedex/blob/master/pokedex/data/csv/languages.csv The data here matches to the Language Names data that you referenced above which will be accessible from one of the Language resources. For instance if you were to follow the url for "Fouinar", The French name of Furret you would find the Language resource something like the one below

{
    "id": 5,
    "name": "fr",
    ...
    "names": [{
        "name": "フランス語",
        "language": {
            "name": "ja",
            "url": "http://localhost:8000/api/v2/language/1/"
        }
    }, {
        "name": "Französisch",
        "language": {
            "name": "de",
            "url": "http://localhost:8000/api/v2/language/6/"
        }
    }, {
        "name": "French",
        "language": {
            "name": "en",
            "url": "http://localhost:8000/api/v2/language/9/"
        }
    }]
}

Veekun's has done a pretty extraordinary job getting really deep with the data. I'm hoping that the api will create some sort of wave of people contributing to their data set so we can keep making the api a greater tool.

bui commented 8 years ago

that makes the most sense, yeah looks good to me!

xrstf commented 8 years ago

Have you considered evaluating the Accept-Language header? If it's sent, you could only return the name of the pokemon and moves in the given language, otherwise provide all languages as drafted above.

lmerotta-zz commented 8 years ago

Sorry to reopen this, but it seems that pokemon names are not translated, any idea on when this will be implemented ?

sargunv commented 8 years ago

They are translated. Check the names field on pokemon-species.

lmerotta-zz commented 8 years ago

@sargunster found it, thanks a lot !

Pathsofpain97 commented 1 year ago

Hello i have a repository and dont know how change the data language of pokeapi in my job. https://github.com/Pathsofpain97/SpanishPokedex.github.io