Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script not working #7

Open
arieltoledo opened this issue Feb 13, 2021 · 5 comments · May be fixed by #17
Open

Script not working #7

arieltoledo opened this issue Feb 13, 2021 · 5 comments · May be fixed by #17

Comments

@arieltoledo
Copy link

Hi, using the example at READ.ME returns

run(fro="en" to="et" src="./untranslated" dest="./translated")
^
SyntaxError: invalid syntax

@dearirshad2
Copy link

Add comma after each arguments

run(fro="en", to="ar", src="/Users/mac/tFrom", dest="/Users/mac/tTo")

@itsnotsaved
Copy link

itsnotsaved commented Oct 16, 2021

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

@sachin-suresh-rapyuta
Copy link

sachin-suresh-rapyuta commented Oct 21, 2022

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'

arkadianriver added a commit to arkadianriver/translate-po that referenced this issue Oct 23, 2022
- enable recursive src/dest
- fix console entry point
- googletrans vrm++ to address zcribe#7
- update readme for these
@arkadianriver arkadianriver linked a pull request Oct 23, 2022 that will close this issue
@AsemKhatib
Copy link

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!

@dearirshad2
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants