Skip to content

Change pybabel keywords from __ to _#2986

Closed
roganw wants to merge 2 commits into
apache:masterfrom
roganw:lazy_gettext
Closed

Change pybabel keywords from __ to _#2986
roganw wants to merge 2 commits into
apache:masterfrom
roganw:lazy_gettext

Conversation

@roganw
Copy link
Copy Markdown
Contributor

@roganw roganw commented Jun 19, 2017

Because of fabmanager babel-extract doesn't support -k gettext , string in __(msg) would never be extract to messages.pot.

@cli_app.command("babel-extract")
@click.option('--config', default='./babel/babel.cfg')
@click.option('--input', default='.')
@click.option('--output', default='./babel/messages.pot')
@click.option('--target', default='app/translations')
def babel_extract(config, input, output, target):
    """
        Babel, Extracts and updates all messages marked for translation
    """
    click.echo(click.style('Starting Extractions config:{0} input:{1} output:{2}'.format(config, input, output), fg='green'))
    os.popen('pybabel extract -F {0} -k lazy_gettext -o {1} {2}'.format(config, output, input))
    click.echo(click.style('Starting Update target:{0}'.format(target), fg='green'))
    os.popen('pybabel update -N -i {0} -d {1}'.format(output, target))
    click.echo(click.style('Finish, you can start your translations', fg='green'))

An alternative solution is replace fabmanager babel-extract with pybabel extract in the CONTRIBUTING.md document:
pybabel extract -F ./babel/babel.cfg -k __ -k _ -o ./babel/messages.pot .

@xrmx
Copy link
Copy Markdown
Contributor

xrmx commented Jun 19, 2017

Good catch! You are changing the semantics though. I think we should try to fix the fabmanager command to support more options.

@roganw
Copy link
Copy Markdown
Contributor Author

roganw commented Jun 19, 2017

@xrmx Your are right! I will create a fix request to Flask-APPBuilder.
And before it would be merged, I submit a new request to superset CONTRIBUTING.md document to avoid overwriting translations by someone again.
modify of CONTRIBUTING.md

@roganw roganw closed this Jun 19, 2017
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 this pull request may close these issues.

2 participants