Re: Javascript translations - Mailing list pgadmin-hackers

From Sarah McAlear
Subject Re: Javascript translations
Date
Msg-id CAGRPzo-m=3KyhVx+=xSUiR9Y4bhfU58nwAErcaH=TJRB24C1Pw@mail.gmail.com
Whole thread Raw
In response to Re: Javascript translations  (Dave Page <dpage@pgadmin.org>)
Responses Re: Javascript translations
List pgadmin-hackers
Hi Hackers,
Sorry about that, we attached the wrong patch file. Attaching the correct one

Thanks
Joao & Sarah

On Mon, Mar 27, 2017 at 1:58 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Mon, Mar 27, 2017 at 11:33 AM, Sarah McAlear <smcalear@pivotal.io> wrote:
> Hi Hackers!
>
> We updated the documentation and included the ability to generate the
> messages.pot files again. We changed the file and function from translate.js
> to gettext.js to be consistent with Python and also to have it automatically
> picked up without having to add extensions to Pybabel. See patch attached.

This doesn't seem to work so well - message extraction now crashes on
various JS files, possibly because babel.cfg treats them as Python not
Javascript. For example:

extracting messages from
pgadmin/browser/static/vendor/aciTree/jquery.aciTree.core.js
(extensions="jinja2.ext.autoescape,jinja2.ext.with_")
Traceback (most recent call last):
  File "/Users/dpage/.virtualenvs/pgadmin4/bin/pybabel", line 11, in <module>
    sys.exit(main())
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/babel/messages/frontend.py",
line 1151, in main
    return CommandLineInterface().run(sys.argv)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/babel/messages/frontend.py",
line 665, in run
    return getattr(self, cmdname)(args[1:])
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/babel/messages/frontend.py",
line 919, in extract
    for filename, lineno, message, comments, context in extracted:
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/babel/messages/extract.py",
line 163, in extract_from_dir
    strip_comment_tags):
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/babel/messages/extract.py",
line 190, in extract_from_file
    strip_comment_tags))
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/babel/messages/extract.py",
line 267, in extract
    for lineno, funcname, messages, comments in results:
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/babel/messages/extract.py",
line 359, in extract_python
    for tok, value, (lineno, _), _, _ in tokens:
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tokenize.py",
line 363, in generate_tokens
    raise TokenError, ("EOF in multi-line statement", (lnum, 0))
tokenize.TokenError: ('EOF in multi-line statement', (2545, 0))

The update should probably also ignore node_modules and static/vendor
directories.

Thanks.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment

pgadmin-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: Javascript translations
Next
From: Atira Odhner
Date:
Subject: Re: Feature test regression failures