Ludeon Forums

RimWorld => Mods => Translations => Topic started by: cappie on October 12, 2014, 01:46:13 PM

Title: Working on a RimWorld translation tool.. need feedback
Post by: cappie on October 12, 2014, 01:46:13 PM
Hi guys,

I'm working on a translation tool that can import new string's from Tynan's original english translation (including the Defs, but right now, they're not yet implemented) to make the translation work a bit easier. I'm doing this because I was fed up with the incomplete translation for alpha 7 :)

NOTE: This tool is meant as an augmentation to the Github translation repositories (not as a replacement!!) for those who aren't as familiar with Git(hub), editing XML files but to know how to properly translate game language-strings..

What I've written right now is a small importer that reads in the Keyed folder from the original English translation. Next step is to also import the Defs folder (which shouldn't be that hard, considering I wrote a recursive directory importer that can handle XML's). The importers are written in such a way that when there's a new version of RimWorld, I can just update the files and re-run the importers to add all the original English strings (the new ones). Running such an import should not affect the translations already in the database then. Anyway, after that I'll write an importer for all current translations, so that the translations database is going to be filled to near completion. My goal is to create a tool with which one can 'generate' the entire language packs for RimWorld, based on which translation is completed or not..

This means that this tool will eventually be able quickly update whenever a new version of RimWorld is released and it can generate the translated 'Keyed' and 'DefInjected' files (in their respective subdirectories) for each language once the missing (new) strings have been translated. I have a first version of the basic translation page running at http://rwt.gamechat.nl/translate.php (rwt = rim world translator)

Feel free to have a look and provide some feedback... let me know if this is useful at all, of not I'll scrap it for own use on other projects, but I thought it might be useful.

My todo list is:

TL;DR: I'm building a RimWorld translation tool (which is not finished yet) for great translators that are not able (or willing) to work with GIT.. got feedback?

UPDATE: released the code on Github.. sorry I didn't check this thread earlier; I kinda lost hope and abandoned it after a month of 0 replies :)
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: Pirx Danford on October 12, 2014, 03:10:48 PM
Its looking very nice.
My suggestions to improve it (besides your todo list):
- also insert a "Home" Link back to the first page and reset the selected language to empty, because right now if I go back via the browser back button the language stays selected, but the overall overview is shown - one has to select empty or another language to switch back to the own language again
- offer a select for Origin between the language select and "only show the first", which filters displayed elements by Origin
- exchange the input type text for the amount of strings to be shown with a select and offer something like 3, 5, 10, all
- make the untranslated strings checkbox do what it is labeled for, so dont use it to remove the display limit (if you use my former suggestion that is done with the all option then), but make it only show untranslated strings when it is checked and additionally display already translated strings when it is unchecked, or make a select with "Untranslated", "Translated", "Both" instead of a checkbox
- introduce a search function which is controlled by a select with the options "All Fields", "String Name", "Origin", "Original English", "Translated Text", meaning the search does search in all fields or only in the subsequently selected fields, only offer the search on each languages page, so you only search within the scope of that language

Thats all for now - great work so far :-)
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: cappie on October 12, 2014, 03:34:33 PM
Thanks for the feedback, the UI isn't final.. I wanted to quickly whip something up to start doing some translations, but after 30 minutes I realised it would be better for me to ask here first.

I'm hoping Tynan will respond to this, because t.b.h. he has the final say about I should continue with this or not.. I think the general idea for an importer-exporter with a centralised translation system could be very useful, however I don't feel that I have the best overview needed for it to be truly useful.

Also, as soon as I have something that works, I will release this on Github.. but right now, the code is rather.. erhm.. prototype'ey.. :)

Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: Tynan on December 10, 2014, 05:54:14 PM
This looks very interesting! Thank you for doing this.

I thought about writing a simple tool that would check a translation and list the missing elements by comparing it to the original English Keyed folder and to the original Defs. Essentially, it could auto-generate a to-do list. That might be another idea for a starting point.

But this looks like a much more full-featured project! I very much hope you can finish it.
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: Sakuukuli on December 11, 2014, 10:49:18 AM
This tool would make translating much easier! It reminds me of https://crowdin.com/, but that one has a monthly fee.

I've made translate-ready templates for translating DefInjected's: https://github.com/Sakuukuli/RimWorld-Templates

I've also included the script that I used to generate those files, it's not pretty but it might give you some ideas: https://github.com/Sakuukuli/RimWorld-Templates/blob/master/RimWorld_DefsToDefinjecteds.py
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: AlyxMS on December 15, 2014, 02:29:12 PM
My biggest pain about translating so far:

No knowing where the problem is.
E.g. Tynan changed Metal to Steel in Alpha 8, the debug log is clearly telling me MineableMetal does not exist, but I end up looking times and times over the thing def folder to find that it is in the Buildings_Natural.xml
I hope this tool would be able to scan all my XML files and locate the keyword "MineableMetal"

Oh and another thing:
<rep>
    <path>XXX.stages[0].label</path>
    <trans>XXX</trans>
</rep>
<rep>
    <path>XXX.stages[0].description</path>
    <trans>XXX</trans>
</rep>
<rep>
    <path>XXX.stages[1].label</path>
    <trans>XXX</trans>
</rep>
....

Making these is a pain. Since alpha 8 utilizes this kind of thing much more than ever.
If templates like this can be auto generated it would be really helpful.
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: Haplo on December 15, 2014, 04:49:05 PM
To find words I know (and mass replace them) I use this: dnGREP (https://code.google.com/p/dngrep/downloads/list)
It's a rather helpful tool to locate these hidden words :)
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: AlyxMS on December 16, 2014, 03:01:54 AM
Quote from: Haplo on December 15, 2014, 04:49:05 PM
To find words I know (and mass replace them) I use this: dnGREP (https://code.google.com/p/dngrep/downloads/list)
It's a rather helpful tool to locate these hidden words :)

Thanks, that's would save me some time on debugging.
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: Nemh on January 03, 2015, 05:04:19 PM
That's perheaps some kind of hidjacking a bit more that topic, but I just create a small script which can be useful associated with the Sakuukul work : I explain, the French translation projet (for example) is actually a bit outdated, but It's also a bit long to check all files, compare them to the Sakuukul template folder, see line per line which label are missing etc... So I just made a little python script (runs fine on my GNU/Linux with python3, I don't know a lot about the Windows or Mac compatibility especially with the files paths, but feel free to modify it) wich takes some arguments and say wich label are missing in the specified file.

With the Keyed's files, it works file by file, with DefInjected it works folder by folder because of the variation of the names of the .xml's. 

Be carefull to modify the template folder path and the local one, to point the ones in your PC, I have this configuration :

Main Folder
       |
       | ------ RimWorld-Templates
       |                  |
       |                  | ----- Keyed
       |                  | ----- DefInjected
       |
       | ------- RimWorld-fr
       |              |
       |              | ----- Keyed
       |              | ----- DefInjected
       |
       | ------- diff.py


and that's works pretty nicely : for example I can this kind of output :
~/Rimworld/Traduction $ python3 diff.py -k Alerts -d BiomeDef
For Keyed/Alerts.xml :
Missing label :  <HunterLacksWeapon>
Missing label :  <HunterLacksWeaponDesc>
Missing label :  <BrawlerHasRangedWeapon>
Missing label :  <BrawlerHasRangedWeaponDesc>
Missing label :  <AlertHypothermia>
Missing label :  <AlertHypothermiaDesc>

For the DefInjected/BiomeDef folder :
File up to date


Help is accessible using the -h option, I don't know if that would be interesting for anyone, but I think that could, tell me (I know I'll use it personally). Also if tyou have any question, just ask there (or on another place if you think I should make another topic)

The script is accessible on this git repo (https://github.com/Nemh/RimWorld-Translation-Diff-Tool) or here (http://lephe.olympe.in/snippet-maker/view.php?s=JasdGg) for direct view, (but no license or Readme, even if it's actually very small right now ^^, and not always up to date I presume). That's one of my very first program in Python, I mainly learnt it today, and I came with only C experience, so the coding quality should be quite poor, but it works, so I'm quite happy ! :)

Edit : I still have some small updates idea, like finding old label wich aren't used anymore, or finding all the missing label in all the file tree, and also fixing some things (try using it with -d TraitDef :s).
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: Gaesatae on January 25, 2015, 07:39:23 PM
I can't even begin to think how much time, work and suffering, the scripts and tools on this thread have saved me.

Sakuukuli: I'm sure I'd have given up at the moment I open the ThingDef folder if it wasn't for your script.
Haplo: dnGREP! I've found love...
Nemh: I've used your script to locate all the lists using the German translation as the template. Saved a lot of time. (I though "if a German couldn't find a list in the code I'm sure a Spaniard like me isn't going to... also if I miss one I could always blame them."  :D ;))

I just wanted to say thanks!
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: cappie on March 19, 2015, 05:04:14 AM
Sorry, but I haven't checked up on this post after a month of no reactions.. I thought it just died :)

Anyway, I released my piece of shit code on GitHUB.. I'll more than gladly host all updated code.. just add a pull request and we'll work on it together.

https://github.com/cappie/rwt
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: Tynan on March 19, 2015, 02:42:52 PM
This is great, I really appreciate you guys writing software to help ease this process.
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: cappie on April 17, 2015, 04:14:06 AM
Hey Tynan, you're welcome man.. I salute you on living the dream of any indi game developer (even with all the coders angst, writersblock and negative folk on the forum and elsewhere you have to deal with)

I'd like to see if I can help by pouring some more time into this and building an importer/exporter for your translation files.. feel free add me on Hangouts (preferable) or drop me a line via (myname}2000{at)gmail.com (hopefully it wont drown in my inbox) to convey any wishes, or if you have a piece of example code that I can port to PHP to easy the suffering of writing the importer :)
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: Humort on April 23, 2015, 03:14:24 AM
There is such site very convenient for the translation.http://opennota.duckdns.org:9000/#/texts (http://opennota.duckdns.org:9000/#/texts)
I ask not to perceive as advertizing, but at this stage, it would be desirable to see something similar in this project, or on the contrary, to use the site for development of the translat
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: Sakuukuli on June 04, 2015, 12:55:21 PM
I just wanted to let everyone know I've updated my templates (https://github.com/Sakuukuli/RimWorld-Templates) to alpha 10 after a long pause in case someone was waiting on it.
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: Tynan on June 04, 2015, 12:56:03 PM
Awesome :)
Title: Re: Working on a RimWorld translation tool.. need feedback
Post by: kaptain_kavern on July 04, 2015, 04:30:14 PM
I'm actually in the process of translating mods to French. For mods with already other languages i have no problem as i just copy/paste English folder before doing my translation directly in the file with Notepad++

No i really don't know how to do with mods where there is no translation yet. Does tools from this thread can help me? (does they work for mods only?)

Thx in advance