Re: Javascript translations

From: Dave Page <dpage(at)pgadmin(dot)org>
To: Sarah McAlear <smcalear(at)pivotal(dot)io>
Cc: Atira Odhner <aodhner(at)pivotal(dot)io>, pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Javascript translations
Date: 2017-03-27 17:58:13
Message-ID: CA+OCxozd9bc2NqcF05-Xti4YQf1sFY0a=y4yUro1FaG9oxWRAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi

On Mon, Mar 27, 2017 at 11:33 AM, Sarah McAlear <smcalear(at)pivotal(dot)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

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Sarah McAlear 2017-03-27 18:06:10 Re: Javascript translations
Previous Message Dave Page 2017-03-27 17:24:52 pgAdmin 4 commit: Ensure client-side translations are correctly extract