Python script to make translations easier

Hi all,

I just created a pretty basic Python script to make translating a game an easier task. It works for Inform 6 and Inform 7 code, and should be adaptable to other languages pretty easily.

Basically, this script pulls all the strings from a source code and writes them in a translation file, in the format

---String the sentence to translate --- Translation <put your translation here>
Once you translated all the strings, simply run the script again and it’ll create the translated source code. The way it’s designed, it also works if you change the original source code in the meantime. If anyone wants to try it and give me some feedback, that would be great!

Which means that even if you don’t know Inform, you can still translate games! (mostly, because at the end of the process you might want to ask for help to include the right librairies, and correct the syntax of I6 verb declaration)
And if you know Inform, it means you can translate a game without touching the code too much, which means you will not add bugs by mistake (I did that a few years ago, a bad copy-paste and your crucial NPC doesn’t say anything anymore…). A caveat: I7 incudes logic in its strings, so it is more dangerous than I6 in that regard.

I’m also hoping to create more interest in translations of games; there are a few non-English games that have garnered praise in their communities but are virtually unknown to English speakers, and conversely non-English communities would welcome and benefit from the translation of classics written in English. It is something I’d very much like to work on, along with other people who would like to help. Would anyone be interested if I set up a public GitHub repository where people would collaborate on translating games?

EDIT: New version with I7 support, post was changed to reflect this

Apologies for necro-posting!

Lots have changed since then: the script is now - still can’t find a better name for it (I like Traducteur, but people would start thinking it’s a Sequitur project :stuck_out_tongue: ). And most importantly, it now outputs .po files, which means you can use software like POEdit (or other internationalization software) to translate your IF!

Today sees the release of its sister project, which does the same thing (extracting strings in a .po file, then creating the translated game from it) for Twine 1.4 games! It might still be a little rough and I havent tested it on a real-world example, but it should work. Hopefully this makes it easier for people to jump in and translate a game they like!

Let me know if you have any comments/questions! :slight_smile:

I will definitely look into using your tools if I get around to translating my Danish language Inform 6 games into English or other languages. I like the idea of separating the translation of text and the “translation” of code and I am curious how much work it will be to “translate” verb declarations and such to other languages (I would guess it takes much longer than the translation of text). Thanks for sharing.