diff options
Diffstat (limited to 'src/jwebmail/__init__.py')
-rw-r--r-- | src/jwebmail/__init__.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/jwebmail/__init__.py b/src/jwebmail/__init__.py index 01b364b..51df9d9 100644 --- a/src/jwebmail/__init__.py +++ b/src/jwebmail/__init__.py @@ -10,6 +10,7 @@ from flask_babel import Babel, get_locale from flask_login import LoginManager, login_required from flask_wtf.csrf import CSRFProtect from jinja2 import ChainableUndefined +from markupsafe import Markup from werkzeug.middleware.proxy_fix import ProxyFix from .css import compile_css_command @@ -83,6 +84,18 @@ def create_app(): route(app) + tr_dict = { + "en": str.maketrans({" ": " "}), + "de": str.maketrans({".": ",", " ": " "}), + } + + @app.template_filter("num_localize") + def num_localize(txt): + if str(get_locale()).startswith("de"): + return Markup(txt.translate(tr_dict["de"])) + else: + return Markup(txt.translate(tr_dict["en"])) + @app.context_processor def inject_version(): return { |