davidchambers / tutor

JavaScript interface for the Gatherer card database
https://gatherer.wizards.com/
Do What The F*ck You Want To Public License
149 stars 18 forks source link

Multiple Language Support #16

Closed pcastellazzi closed 12 years ago

pcastellazzi commented 12 years ago

I was playing a bit with tutor and it awesome. Can you please add the posibility to query card information in different languages? and a list of avaialable translations for a card?

davidchambers commented 12 years ago

Does Gatherer provide translations, do you know? Does one, for example, receive a card's text in Italian if one's browser states a preference for Italian?

pcastellazzi commented 12 years ago

Each card has a different multiverse id. Cards with different languages too. (It's not the same Clone in english than in spanish). To get a translation you need to go to the languages tab, select the version you want, en then click in printed text. The default oracle text is always in english and most of the time it differs from the printed text, even for english cards, specially for older cards. i.e. Older cards used to say "goes to the graveyard", and the oracle text now refer to this action as "it dies".

Being more specific about your question. The answer is no. There is a site wide language preference but not work as you describe. For the purpuse of my request i only require the printed text in different languages. Not, not the ability to search by it.

I simple but effective way to implement this would be for tutor to scrap the languages tab of a card, and return a hash with something like language => multiverseid. And allow to find cards by multiverse id. Also since accessing the languages tabs require a new http request, may be is better to separate this functionality in a different uri.

On Mon, Jun 25, 2012 at 3:00 AM, David Chambers reply@reply.github.com wrote:

Does Gatherer provide translations, do you know? Does one, for example, receive a card's text in Italian if one's browser states a preference for Italian?


Reply to this email directly or view it on GitHub: https://github.com/davidchambers/tutor/issues/16#issuecomment-6540211

The lights then came up and the crowd erupted in applause, because that's what the crowd does after it watches destruction on a large screen. -- Ben Kuchera, Modern Warfare 3 review.

davidchambers commented 12 years ago

It's now possible to retrieve a card's details in languages other than English. For example:

> curl http://localhost:3000/card/273088?printed=true
{
  "name": "Skaab cuirassé",
  ...
  "text": "Quand le Skaab cuirassé arrive sur le champ de bataille, mettez les quatre cartes du dessus de votre bibliothèque dans votre cimetière.",
  ...
  "gatherer_url": "http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=273088&printed=true",
  "flavor_text": "Conçu pour la bataille, littéralement.",
  ...
  "type": "Créature : - zombie et guerrier"
}

Note that the response contains a type string rather than types and subtypes arrays, to avoid language-specific parsing logic.

pcastellazzi commented 12 years ago

Awesome! Thank you very much.

On Mon, Jul 2, 2012 at 12:51 AM, David Chambers reply@reply.github.com wrote:

It's now possible to retrieve a card's details in languages other than English. For example:

> curl http://localhost:3000/card/273088?printed=true
{
  "name": "Skaab cuirassé",
  ...
  "text": "Quand le Skaab cuirassé arrive sur le champ de bataille, mettez les quatre cartes du dessus de votre bibliothèque dans votre cimetière.",
  ...
  "gatherer_url": "http://gatherer.wizards.com/Pages/Card/Details.aspx?multiverseid=273088&printed=true",
  "flavor_text": "Conçu pour la bataille, littéralement.",
  ...
  "type": "Créature : - zombie et guerrier"
}

Note that the response contains a type string rather than types and subtypes arrays, to avoid language-specific parsing logic.


Reply to this email directly or view it on GitHub: https://github.com/davidchambers/tutor/issues/16#issuecomment-6700035

The lights then came up and the crowd erupted in applause, because that's what the crowd does after it watches destruction on a large screen. -- Ben Kuchera, Modern Warfare 3 review.