winterheart / RimTranslate

Tool for translation RimWorld
GNU General Public License v3.0
6 stars 2 forks source link

Getting an error when generating translated files #3

Closed NancokPS2 closed 3 years ago

NancokPS2 commented 3 years ago
Traceback (most recent call last):
  File "RimTranslate.py", line 364, in <module>
    logging.info("Creating XML file for " + pofilename)
NameError: name 'pofilename' is not defined

I used Poedit for editing and added a comment as said in the readme, tried deleting everything and starting over, i just get the same error Using Python 3.4.4 since it's the latest one of which there are files of My command looks like this:

Y:\Python34\python.exe RimTranslate.py -o C:\Users\Usuario\Documents\Mods\RimWorld\Tools\RimTranslate-master\Translations_Finished -p C:\Users\Usuario\Documents\Mods\RimWorld\Tools\RimTranslate-master\Translations
NancokPS2 commented 3 years ago

Update: exchanged -o and -p and the error stopped, but as expected it just says that there's no PO files

NancokPS2 commented 3 years ago

I'm a newbie at python so sorry if i'm just talking bs, but could it be this lines (starting at line 240)?

 defs_source_dir = os.path.join(args.source_dir, 'Defs', '')

    if os.path.isdir(defs_source_dir):
        for root, dirs, files in os.walk(defs_source_dir):

Seems like it's looking for a folder named Defs, but the folder is called DefInjected I changed the folder name but i got the same error

NancokPS2 commented 3 years ago

Another Update: deleting all po files seems to fix the error, it just says that there are no translated files instead, but as soon as i try to translate any the error returns

winterheart commented 3 years ago

Hi again.

Try to run this command (you can even write some *.bat file to automate this):

Y:\Python34\python.exe RimTranslate.py -s SOURCE -p PODIR -o DEST

where

This is simple illustration of workflow:

[ SOURCE ] -- RimTranslate --> [ PODIR ] -- RimTranslate --> [ DEST ]

You can combine -s, -p, -o options, but you should either define -s and -p OR -p and -o.

NancokPS2 commented 3 years ago

THX, it is working now, using that same command i can both generate the POs and translate them with a single bat (i was using bats beforehand, but i had one for each action) This one is working without errors as far as i can see, closed.