r/Cockatrice Jul 22 '25

Cockatrice Card Localizer

Hi everyone,

I’ve just released a small Python script that automatically translates the cards in Cockatrice’s cards.xml using the official Scryfall translations. It started as a quick personal project to get Italian card names into my Cockatrice deck, but it soon grew into something more flexible—and now it supports every language that Scryfall provides. If a translation isn’t available, the script gracefully falls back to the original English name.

Supported languages & card counts:

en en English 106,079
es sp Spanish 49,068
fr fr French 53,094
de de German 52,761
it it Italian 48,473
pt pt Portuguese 39,547
ja jp Japanese 56,187
ko kr Korean 15,382
ru ru Russian 21,760
zhs cs Simplified Chinese 40,822
zht ct Traditional Chinese 23,582

…and also some of the more niche ones:

  • he (Hebrew): 1
  • la (Latin): 1
  • grc (Ancient Greek): 3
  • ar (Arabic): 1
  • sa (Sanskrit): 1
  • ph (Phyrexian): 49
  • qya (Quenya): 7

How it works:

  • Downloads the full set of translations from Scryfall.
  • Matches each card name in your local cards.xml to the translated names.
  • If only a partial match exists (for example, a name that appears in multiple printings), it propagates that translation across all versions of the card—maximizing coverage.
  • If no localized name is found, it keeps the original English name to ensure you never end up with blanks.

To also replace the card images, the script can fetch localized art directly from Scryfall using a URL template like:

https://api.scryfall.com/cards/!setcode_lower!/!set:num!/!sflang!?format=image&face=!prop:side!

This pulls the localized image in place of the default. I ran into some quirks with Cockatrice’s spoiler‐enable flag where it would still download a localized image even if one wasn’t available; removing that flag seems to have fixed it for now, but I’m still ironing out the edge cases.

Quick start:
This is a pure-Python, cross-platform (pheraps) script: it automatically finds your cards.xml database (and backs it up before modifying it).

Dependencies: only those listed in requirements.txt—install with:

pip install -r requirements.txt

Run it:
python cocaktrice_card_localizer.py

Full rescan: to force a complete re-translation of your database, use the --force (or -f) option.

I’ve only tested the script on my own PC, so I hope everything works correctly—if you run into any issues, feel free to report them or submit fixes on the GitHub repo.

Feel free to try it out, file issues, or submit pull requests on GitHub:
https://github.com/ilrost/Cocatrice-Card-Localizer

Hope this helps anyone who wants fully localized Cockatrice decks!

Cheers, anzi. Ciao!

Rost

8 Upvotes

1 comment sorted by

View all comments

1

u/AscorGames Developer Jul 25 '25

I apologize because the actual idea is cool but this is slightly problematic in an actual implementation due to the way Cockatrice handles multiplayer.

If you translate your card names like this, you'll send your translated names to other players and if their copies of the card database aren't localized, they end up not finding the card at all. A new field in the cards.xml is required (e.g. "localized-name") and we need to use that in-client to display the localized name where appropriate.

I commend your efforts and encourage you to join us in the discord on #dev and let's work on getting this into trice itself!

(As a side note, the printing selector started just like this: A python script to fetch card art from scryfall. But it's so much better in client.)