translate-po
translate-po copied to clipboard
Script not working
Hi, using the example at READ.ME returns
run(fro="en" to="et" src="./untranslated" dest="./translated") ^ SyntaxError: invalid syntax
Add comma after each arguments
run(fro="en", to="ar", src="/Users/mac/tFrom", dest="/Users/mac/tTo")
Is it possible to translate .json
, .xml
, xliff
files using that? i guess this script doesn't need set-up gAPI right?
There's an option, transifex but still require configure gAPI; i don't like create account and give away creditcard info and 100% free option is matecat but seems it doesn't has oneclick option
I tried with commas after each argument. I get the below error: @dearirshad2
Traceback (most recent call last):
File "po.py", line 5, in <module>
run(fro="en", to="ja", src="/home/sachin/Desktop/locale/ja/LC_MESSAGES", dest="/home/sachin/Desktop/locale/ja_translated/")
File "/home/sachin/.local/lib/python3.8/site-packages/translate_po/main.py", line 55, in run
solve(os.path.join(arguments.dest, file), os.path.join(arguments.src, file), arguments)
File "/home/sachin/.local/lib/python3.8/site-packages/translate_po/main.py", line 27, in solve
line.msgstr = polib.unescape(translate(polib.escape(line.msgid), arguments))
File "/home/sachin/.local/lib/python3.8/site-packages/translate_po/main.py", line 15, in translate
return translator.translate(source, dest=arguments.to, src=arguments.fro).text
File "/home/sachin/.local/lib/python3.8/site-packages/googletrans/client.py", line 182, in translate
data = self._translate(text, dest, src, kwargs)
File "/home/sachin/.local/lib/python3.8/site-packages/googletrans/client.py", line 78, in _translate
token = self.token_acquirer.do(text)
File "/home/sachin/.local/lib/python3.8/site-packages/googletrans/gtoken.py", line 194, in do
self._update()
File "/home/sachin/.local/lib/python3.8/site-packages/googletrans/gtoken.py", line 62, in _update
code = self.RE_TKK.search(r.text).group(1).replace('var ', '')
AttributeError: 'NoneType' object has no attribute 'group'
I tried with commas after each argument. I get the below error: @dearirshad2
Traceback (most recent call last): File "po.py", line 5, in <module> run(fro="en", to="ja", src="/home/sachin/Desktop/locale/ja/LC_MESSAGES", dest="/home/sachin/Desktop/locale/ja_translated/") File "/home/sachin/.local/lib/python3.8/site-packages/translate_po/main.py", line 55, in run solve(os.path.join(arguments.dest, file), os.path.join(arguments.src, file), arguments) File "/home/sachin/.local/lib/python3.8/site-packages/translate_po/main.py", line 27, in solve line.msgstr = polib.unescape(translate(polib.escape(line.msgid), arguments)) File "/home/sachin/.local/lib/python3.8/site-packages/translate_po/main.py", line 15, in translate return translator.translate(source, dest=arguments.to, src=arguments.fro).text File "/home/sachin/.local/lib/python3.8/site-packages/googletrans/client.py", line 182, in translate data = self._translate(text, dest, src, kwargs) File "/home/sachin/.local/lib/python3.8/site-packages/googletrans/client.py", line 78, in _translate token = self.token_acquirer.do(text) File "/home/sachin/.local/lib/python3.8/site-packages/googletrans/gtoken.py", line 194, in do self._update() File "/home/sachin/.local/lib/python3.8/site-packages/googletrans/gtoken.py", line 62, in _update code = self.RE_TKK.search(r.text).group(1).replace('var ', '') AttributeError: 'NoneType' object has no attribute 'group'
same error here!
@AsemKhatib the problem is at self.RE_TKK.search(r.text).group(1).replace('var ', '')
and precisely this self.RE_TKK.search(r.text)
code is returning None because of which group cannot be applied. You should catch the exception and see.