Spaces:
Runtime error
Runtime error
| import os | |
| from flask import Blueprint | |
| import click | |
| bp = Blueprint('cli', __name__, cli_group=None) | |
| def translate(): | |
| """Translation and localization commands.""" | |
| pass | |
| def init(lang): | |
| """Initialize a new language.""" | |
| if os.system('pybabel extract -F babel.cfg -k _l -o messages.pot .'): | |
| raise RuntimeError('extract command failed') | |
| if os.system( | |
| 'pybabel init -i messages.pot -d app/translations -l ' + lang): | |
| raise RuntimeError('init command failed') | |
| os.remove('messages.pot') | |
| def update(): | |
| """Update all languages.""" | |
| if os.system('pybabel extract -F babel.cfg -k _l -o messages.pot .'): | |
| raise RuntimeError('extract command failed') | |
| if os.system('pybabel update -i messages.pot -d app/translations'): | |
| raise RuntimeError('update command failed') | |
| os.remove('messages.pot') | |
| def compile(): | |
| """Compile all languages.""" | |
| if os.system('pybabel compile -d app/translations'): | |
| raise RuntimeError('compile command failed') | |