translations fix
This commit is contained in:
parent
7f2da24224
commit
7cc8b9b52d
@ -1,4 +1,4 @@
|
||||
from config import TEMPLATES_FOLDER, STATIC_FOLDER
|
||||
from config import TEMPLATES_FOLDER, STATIC_FOLDER, APP_BASE_URL, PORT
|
||||
from oshipka.persistance import populate_static, init_db
|
||||
|
||||
from populate import populate_db
|
||||
@ -12,4 +12,6 @@ app.template_folder = TEMPLATES_FOLDER
|
||||
app.static_folder = STATIC_FOLDER
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(port=5000, debug=True, ssl_context=('webapp/ssl/cert.crt', 'webapp/ssl/cert.key'))
|
||||
print("Running on {}".format(APP_BASE_URL))
|
||||
app.run(port=PORT, debug=True, ssl_context=('webapp/ssl/cert.crt', 'webapp/ssl/cert.key'))
|
||||
|
||||
|
@ -214,6 +214,13 @@ bootstrap() {
|
||||
python manager.py db migrate -m "001"
|
||||
_post_migrate
|
||||
python manager.py db upgrade
|
||||
|
||||
command_translate "" extract
|
||||
command_translate "" gen en
|
||||
# TODO: sed acts on a line-by-line
|
||||
# sed -i 's/msgid "Project"/msgstr ${PROJECT_NAME}/' translations/en/LC_MESSAGES/messages.po
|
||||
command_translate "" compile
|
||||
|
||||
git init .
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
|
@ -275,8 +275,8 @@ def register_index_svc():
|
||||
|
||||
|
||||
def _init_translations(app):
|
||||
from flask_babelex import Babel
|
||||
babel = Babel(app)
|
||||
from flask_babelex import Babel, gettext, Domain
|
||||
babel = Babel(app, default_domain=Domain(dirname='translations'))
|
||||
|
||||
@babel.localeselector
|
||||
def get_locale():
|
||||
@ -298,6 +298,7 @@ def init_db(app):
|
||||
app.config["SQLALCHEMY_DATABASE_URI"] = SQLALCHEMY_DATABASE_URI
|
||||
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
|
||||
app.config["WHOOSH_BASE"] = SEARCH_INDEX_PATH
|
||||
app.config["BABEL_TRANSLATION_DIRECTORIES"] = '/translations'
|
||||
try:
|
||||
from config import TRANSLATION_LANGUAGES
|
||||
app.config["TRANSLATION_LANGUAGES"] = TRANSLATION_LANGUAGES
|
||||
|
Loading…
Reference in New Issue
Block a user