e161237894
Docker Build and Push / build-and-push (push) Successful in 47s
- Restored broken download tooltips that showed raw template placeholders instead of rendered values - Simplified `autobuild.py` by removing unnecessary fallback/parsing complexity and reducing helper overhead - Audited non-ASCII characters and get rid of Unicode “gremlins” that are not supported by WebView - Converted hardcoded external template links to protocol-relative `//...` URLs so they follow the current site scheme Reviewed-on: #14 Reviewed-by: Gleb Zaharov <risdeveau@lair.moe> Co-authored-by: Burer <burer@kolibrios.org> Co-committed-by: Burer <burer@kolibrios.org>
24 lines
583 B
Python
24 lines
583 B
Python
from datetime import date
|
|
|
|
from flask import redirect, render_template, request, url_for
|
|
from htmlmin import minify as minify_html
|
|
|
|
from modules import locales
|
|
|
|
|
|
def get_best_lang():
|
|
return request.accept_languages.best_match(locales.locales_code) or "en"
|
|
|
|
|
|
def render_localized_template(lang, template_name):
|
|
if lang not in locales.locales_code:
|
|
return redirect(url_for("index", lang=get_best_lang()))
|
|
|
|
return minify_html(
|
|
render_template(
|
|
template_name,
|
|
year=date.today().year,
|
|
),
|
|
remove_empty_space=False,
|
|
)
|