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

Change pybabel keywords from __ to _ #2986

Closed
wants to merge 2 commits into from
Closed

Conversation

roganw
Copy link
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
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
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