mythkiven / mkTranslate

automatically translate iOS string files and Android xml files . Conversion between Traditional and Simplified Chinese
MIT License
45 stars 9 forks source link

Unicode Encode Error #4

Open frankai opened 5 years ago

frankai commented 5 years ago

Hi! thanks for this useful tool.

Trying to use it the tool (macOS Catalina, strings file) it returns this error, any clue to fix it?

Thanks in advance! Franky


original:"Miscellaneous Arrows" = "Flechas Varios"; translated:"Miscellaneous Arrows" ="Várias setas";

Traceback (most recent call last): File "/usr/local/bin/translate", line 33, in main() File "/usr/local/bin/translate", line 29, in main mkTranslator().translate_doc(filepath=args.file_path, destination=args.dest_language,sourcelanguage=args.sourcelanguage,channel=args.channel) File "/Library/Python/2.7/site-packages/mkTranslation/translator.py", line 165, in translate_doc self.write_tx(filepath,newFile,r"=\s\"(.+?)\"\s;",'="'+'content'+'";',destination,sourcelanguage,channel) File "/Library/Python/2.7/site-packages/mkTranslation/translator.py", line 116, in write_tx f.write(txd) UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 169: ordinal not in range(128)

frankai commented 5 years ago

Just in case, I was trying to translate from EN to PT using Google Translate.

ProfessorVarox commented 4 years ago

did you use pip install mkTranslation ? Then use pip3 install mkTranslation that worked for me

macluky commented 4 years ago

I can confirm that works note that catelina defaults to pyhton2.7 so be aware which one you pick

aydinozkan commented 4 years ago

You may need sudo -H pip3 install mkTranslation