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

translations extracted by pybabel #2990

Merged
merged 1 commit into from
Jun 20, 2017
Merged

Conversation

roganw
Copy link
Contributor

@roganw roganw commented Jun 19, 2017

fabmanager babel-extract won't extract the string of __(msg).
So, I extract the translations by command:
pybabel extract -F ./babel/babel.cfg -k __ -k _ -o ./babel/messages.pot .

__ and _ are the alias of gettext and laze_gettext respectively.

@mistercrunch
Copy link
Member

LGTM. At some point we'll have to figure out how we manage translations on the frontend side.

@mistercrunch mistercrunch merged commit 9051e1f into apache:master Jun 20, 2017
@roganw
Copy link
Contributor Author

roganw commented Jun 20, 2017

@mistercrunch Yeah, some messages in js files need to be translated, we can refer the solutions of other application.
Such as Odoo, which extract to po by babel and load translations to frontend variable by JS request.
extract js translations in the backend

from babel.messages import extract
extract_method = 'javascript'
src_file = 'js file path'
extract_keywords = {{'_t': None, '_lt': None}}
extracted = extract.extract(extract_method, src_file, keywords=extract_keywords)

And then translate on frontend side

(It's exciting if FAB contains these function. )

@xrmx
Copy link
Contributor

xrmx commented Jun 20, 2017

The sentry guys which have a mixed python / react environment likes us developed this:
https://www.npmjs.com/package/babel-gettext-extractor

Blog post:
https://blog.sentry.io/2016/01/07/react-i18n

@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.18.5 labels Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.18.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants