from flask import Flask, render_template, request
from i18n import get_translations, SUPPORTED_LANGS

app = Flask(
    __name__,
    template_folder="templates",
    static_folder="resources",
    static_url_path="/resources",
)


@app.route("/")
def index():
    lang = request.args.get("lang", "it")
    if lang not in SUPPORTED_LANGS:
        lang = "it"
    t = get_translations(lang)
    return render_template("index.html", t=t, lang=lang, supported_langs=SUPPORTED_LANGS)


if __name__ == "__main__":
    app.run(debug=False)
