From c13e80bf2add34428031eb4b655b269ca1c8d7c7 Mon Sep 17 00:00:00 2001 From: Viktor Haid <52320564+viktorhaid@users.noreply.github.com> Date: Wed, 11 Sep 2024 19:51:17 +0200 Subject: [PATCH] fix i18n (#375) * fix i18n * Ignore linter error regarding _ --- Dockerfile | 5 ++++- MANIFEST.in | 1 + snappass/main.py | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 70e18c5..871a0ff 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,10 +11,13 @@ WORKDIR $APP_DIR COPY ["setup.py", "requirements.txt", "MANIFEST.in", "README.rst", "AUTHORS.rst", "$APP_DIR/"] COPY ["./snappass", "$APP_DIR/snappass"] +RUN pip install -r requirements.txt + +RUN pybabel compile -d snappass/translations + RUN python setup.py install && \ chown -R snappass $APP_DIR && \ chgrp -R snappass $APP_DIR -RUN pip install -r requirements.txt USER snappass diff --git a/MANIFEST.in b/MANIFEST.in index ec67e98..e919377 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,4 @@ include *.rst LICENSE recursive-include snappass/static * recursive-include snappass/templates * +recursive-include snappass/translations * diff --git a/snappass/main.py b/snappass/main.py index 2c16cdc..09867e4 100644 --- a/snappass/main.py +++ b/snappass/main.py @@ -11,7 +11,8 @@ from urllib.parse import quote_plus from urllib.parse import unquote_plus from urllib.parse import urljoin from distutils.util import strtobool -from flask_babel import Babel +# _ is required to get the Jinja templates translated +from flask_babel import Babel, _ # noqa: F401 NO_SSL = bool(strtobool(os.environ.get('NO_SSL', 'False'))) URL_PREFIX = os.environ.get('URL_PREFIX', None)