From c0e2c151dfd997f3e3ff1ff8b5dbf70864aa74fb Mon Sep 17 00:00:00 2001
From: brenko <514386@muni.cz>
Date: Sat, 3 Sep 2022 05:05:08 +0200
Subject: [PATCH] feat: translation files

---
 __pycache__/app.cpython-310.pyc         | Bin 3185 -> 2963 bytes
 app.py                                  |  53 +++++++++-----------
 babel.cfg                               |   2 +
 config_templates/config-template.yaml   |  22 +++++----
 setup.py                                |   6 ++-
 templates/IsTestingSP.html              |   5 +-
 templates/SPAuthorization.html          |   7 +--
 templates/_footer.html                  |  42 ++++++++--------
 templates/_header.html                  |  50 +++++++++----------
 templates/authorization.html            |   8 ++--
 templates/base.html                     |   8 ++--
 translations/cs/LC_MESSAGES/messages.po |  61 ++++++++++++++++++++++++
 12 files changed, 166 insertions(+), 98 deletions(-)
 create mode 100644 babel.cfg
 create mode 100644 translations/cs/LC_MESSAGES/messages.po

diff --git a/__pycache__/app.cpython-310.pyc b/__pycache__/app.cpython-310.pyc
index 76d9cf49e33a7b703ac3d6408a209a9934151f8a..aea3ec86d0a6c9480ad966848537aeb83ecc9d13 100644
GIT binary patch
delta 1985
zcmew;F<G21pO=@5fq{XceW7~tKhBAKGK|wEYHQZ#azt@3GNdr1Fz0aQaz%0Faz}CJ
z@<j1~#aME9bNQn9a`~h9!F<*nfn32T!CavzAuyjYM>tA2l_^!EnK4Q<l`B=WnK4Q%
zRXl|)g}s@npEpV(Rd|79s>DLZD5-FU6h;;X7KUbKMut2NLx$qOaz;i5#(D-uhDZiR
zh7^uesWQf*xD?J*sT2+yhE%B(E=h(|(Rk@psT6KWhA5d-sT3YbhA7!osT5vGhA6pI
zsT4j*hA8<I{#1n&fmFdXmK4Dhp%#`X#T4OGg%lC6s8AYPifD>h3rmzzig=1d3qzE0
zs%Vx<ie!pZ3qvzwlxlsdSe9Cfbczg^%bhB^Ks`lvA!CYMiac0E11zGjkTFFuMF}jT
z2^LXa$e5y%q6!w#0*k0EWK2;{(Ey8Rr;4O#W-}F?Ocl-2NzqEt?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4%VU}blVNYQJlOQ%n4MQ`d
zBtr>j31<n6%~ir(!qd!<!rIFl%%I8UcZ&m-bgKlA5;QoZZgCW+CWE4@7*rk=<tCPB
z@)QZwgZvH;w<19h*BV6FFfcGg@h6uS6{Y5t#6z_ff&3mN0275-RwNA4Ap+9DU09l0
zR2h(1l$cwr$qUK4EQv+w#gG^P1$hy2G}JRN++uU{_YZLmy2V^vQgn;c$I;I{)Y08F
z_!f(gzq|h}7C%Q{*IO(pnaL%Zj73%;o6w?(H?ugt1d@5<iwi<QaRe%#1eg#p#Kg$P
z$i~RW$i&D6PMIu>Y@dr<7#J8PKjIW+HYhTj{EJh=HHteeC$Ts?J}EINHK&LJWEI%K
zp!zwABda{QsIs6WA5utzO2a4~n3!Hxd3F&mNCV&G94-Y$@yWeh;(k%g$!X~jkHb@4
z6laLPx2s>gqmO%$5=et0h_C|@4j{r2L^y#6dk_IC#=)g+k;>$cT*CF>vg;OWQGRJj
zYLPZb1t|A{6Cc<=x0s7c^N_MDIH<sRmcu4DKczG$)ee*ri$N)wgF%5wgi(M|fRTfd
zgNcKYhlz(#=06WJ4<iRN2P3Fz;b8<pA!adl4ptUcE=CSf7A{5(5EkHK<ly0A<Pa8M
HWcd#O_NfFx

diff --git a/app.py b/app.py
index eda1d80a..2ace287b 100644
--- a/app.py
+++ b/app.py
@@ -1,6 +1,6 @@
 import json
 
-from flask import Flask, render_template, request, redirect, make_response, jsonify
+from flask import Flask, render_template, request, redirect, make_response, jsonify, session
 from flask_babel import Babel, get_locale, gettext
 from jwcrypto import jwk, jwt
 from jwcrypto.jwk import JWKSet, JWK
@@ -12,17 +12,15 @@ babel = Babel(app)
 with open("config_templates/config-template.yaml", "r") as ymlfile:
     cfg = yaml.safe_load(ymlfile)
 
-CSS_FRAMEWORK = cfg.get('css_framework', 'bootstrap')
-MUNI_FACULTY = cfg.get('MUNI_faculty', None)
+if 'css_framework' not in cfg:
+    cfg['css_framework'] = 'bootstrap'
 
+app.secret_key = cfg["secret_key"]
 
 TOKEN_ALG = cfg['token_alg']
 KEY_ID = cfg['key_id']
 KEYSTORE = cfg['keystore']
-FOOTER = cfg.get('footer', None)
-LANGUAGES = cfg.get('languages', None)
-LOGO = cfg.get('logo', None)
-NAME = cfg.get('name', None)
+REDIRECT_URL = cfg['redirect_url']
 
 
 def import_keys(file_path: str) -> JWKSet:
@@ -42,14 +40,21 @@ def verify_jwt(token):
     return jwt.JWT(jwt=token, key=jwk_key).claims
 
 
+@app.context_processor
+def inject_conf_var():
+    return dict(cfg=cfg, lang=get_locale())
+
+
 @babel.localeselector
-def select_locale():
-    return request.accept_languages.best_match(["en", "cs"])
+def get_locale():
+    if request.args.get('lang'):
+        session['lang'] = request.args.get('lang')
+    return session.get('lang', 'en')
 
 
 @app.route('/')
 def index():
-    return redirect('/IsTestingSP?language=en')
+    return redirect('/IsTestingSP')
 
 
 @app.route('/authorization/<message>')
@@ -57,48 +62,36 @@ def authorization(message):
     message = json.load(verify_jwt(message))
     email = message.get('email')
     service = message.get('service')
+    registration_url = message.get('registration_url')
     if not email or not service:
-        return make_response(jsonify({"fail": "Missing request parameter"}), 400)
+        return make_response(jsonify({gettext("fail"): gettext("Missing request parameter")}), 400)
     return render_template(
         "authorization.html",
         email=email,
         service=service,
-        css_framework=CSS_FRAMEWORK,
-        faculty=MUNI_FACULTY,
-        locale=get_locale()
+        registration_url=registration_url,
     )
 
 
 @app.route('/SPAuthorization/<message>')
 def sp_authorization(message):
     message = json.load(verify_jwt(message))
+    email = message.get('email')
+    service = message.get('service')
     registration_url = message.get('registration_url')
     return render_template(
         "SPAuthorization.html",
+        email=email,
+        service=service,
         registration_url=registration_url,
-        css_framework=CSS_FRAMEWORK,
-        faculty=MUNI_FACULTY,
-        locale=get_locale()
     )
 
 
 @app.route('/IsTestingSP')
 def is_testing_sp():
-    language = request.args.get('language', get_locale())
     return render_template(
         "IsTestingSP.html",
-        css_framework=CSS_FRAMEWORK,
-        faculty=MUNI_FACULTY,
-        locale=language,
-        footer=FOOTER,
-        sections=FOOTER['sections'],
-        format=FOOTER['format'],
-        current_section=FOOTER['sections'][str(language)],
-        languages=LANGUAGES,
-        current_language=LANGUAGES[str(language)],
-        logo=LOGO,
-        name=NAME,
-        queryParams=dict()
+        redirect_url=REDIRECT_URL
     )
 
 
diff --git a/babel.cfg b/babel.cfg
new file mode 100644
index 00000000..155a6fa8
--- /dev/null
+++ b/babel.cfg
@@ -0,0 +1,2 @@
+[python: **.py]
+[jinja2: **/templates/**.html]
\ No newline at end of file
diff --git a/config_templates/config-template.yaml b/config_templates/config-template.yaml
index dc146948..bf08f979 100644
--- a/config_templates/config-template.yaml
+++ b/config_templates/config-template.yaml
@@ -1,4 +1,4 @@
-css_framework: MUNI
+css_framework: bootstrap
 MUNI_faculty:
 keystore: path
 key_id: id
@@ -7,13 +7,19 @@ footer:
   format: HTML
   sections:
     cs:
-      - Zprava
-      - Zprava2
+      - Máte problém s přihlášením?
+      - Službu Autentizační brána zajišťuje Ústav výpočetní techniky.
     en:
-      - message
-      - message2
+      - Having trouble logging in?
+      - The Authentication Gateway service is provided by the Institute of Computer Science.
+    de:
+      - de1
+      - de2
 languages:
-  cs: Cestina
+  cs: Čeština
   en: English
-logo:
-name: MUNI
\ No newline at end of file
+  de: Deutsch
+logo: static/MuniWeb/img/favicon.ico
+name: MUNI
+secret_key: secret
+redirect_url: url
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 8dd07ce1..5f9e60cd 100644
--- a/setup.py
+++ b/setup.py
@@ -7,6 +7,10 @@ setup(
     description="Module with gui for perun proxy",
     packages=find_packages(),
     install_requires=[
-        "setuptools"
+        "setuptools",
+        "PyYAML>=6.0<7",
+        "Flask>=2.2.2<3",
+        "jwcrypto>=1.3.1<2",
+        "Flask-Babel>=2.0.0<3",
     ],
 )
diff --git a/templates/IsTestingSP.html b/templates/IsTestingSP.html
index 2532b93c..bcfb2c49 100644
--- a/templates/IsTestingSP.html
+++ b/templates/IsTestingSP.html
@@ -1,11 +1,12 @@
 {% extends 'base.html' %}
 
 {% block head %}
-<title>Authorization page</title>
+<title></title>
 {% endblock %}
 
 {% block content %}
 <div class="content">
-    <h1 style="text-align: center">IsTestingSp page</h1>
+    <h1 style="text-align: center"><span>{{ _("You are about to access service, which is in testing environment.") }}</span></h1>
+<h1 style="text-align: center"> <a href="{{ redirect_url }}"><span>{{ _("Continue") }}</span></a></h1>
 </div>
 {% endblock %}
\ No newline at end of file
diff --git a/templates/SPAuthorization.html b/templates/SPAuthorization.html
index 6ab2cddc..2ac83399 100644
--- a/templates/SPAuthorization.html
+++ b/templates/SPAuthorization.html
@@ -4,9 +4,10 @@
 <title>Authorization page</title>
 {% endblock %}
 
-{% block body %}
+{% block content %}
 <div class="content">
-    <h1 style="text-align: center">SPAuthorization page</h1>
-    <h1 style="text-align: center"> <a href="{{ registration_url }}">register here</a></h1>
+    <h1 style="text-align: center"><span>{{ _("You are not authorized to access the service ") }}</span> {{ _("service") }}</h1>
+    <h1 style="text-align: center"><span>{{ _('We will now redirect you to a registration page, where you will apply for the access.') }}</span></h1>
+    <h1 style="text-align: center"> <a href="{{ registration_url }}"><span>{{ _("Proceed to registration") }}</span></a></h1>
 </div>
 {% endblock %}
\ No newline at end of file
diff --git a/templates/_footer.html b/templates/_footer.html
index a76e4b64..b8fa36ac 100644
--- a/templates/_footer.html
+++ b/templates/_footer.html
@@ -1,40 +1,40 @@
 <!DOCTYPE html>
-{% if footer is not none and sections is not none %}
-    {% if css_framework == 'MUNI' %}
-        {% if current_section is not none %}
-            {% set colSize = 4 / current_section | length %}
+{% if cfg.footer is not none and cfg.footer.sections is not none %}
+    {% if cfg.css_framework == 'MUNI' %}
+        {% if cfg.footer.sections[lang] is not none %}
+            {% set colSize = 4 / cfg.footer.sections[lang] | length %}
         {% else %}
-            {% set colSize = 4 / sections | length %}
+            {% set colSize = 4 / cfg.sections | length %}
         {% endif %}
     {% else %}
-        {% if current_section is not none %}
-            {% set colSize = 12 / current_section | length %}
+        {% if cfg.footer.sections[lang] is not none %}
+            {% set colSize = 12 / cfg.footer.sections[lang] | length %}
         {% else %}
-            {% set colSize = 12 / sections | length %}
+            {% set colSize = 12 / cfg.footer.sections | length %}
         {% endif %}
     {% endif %}
- <footer class="footer text-left{% if not css_framework == 'MUNI' %} bg-secondary secondary-contrast-color{% endif %}">
-        <div class="{% if css_framework == 'MUNI' %}grid{% else %}row{% endif%} footer-margin">
-            {% if current_section is not none %}
-                {% for block in current_section %}
-                    {% if format is not none and (format == 'HTML' or format == 'markdown') %}
-                        <div class="{% if css_framework == 'MUNI' %}grid__cell size--m--{{ colSize }}-4{% else %}col-padding-0 col-md-{{ colSize }}{% endif %}">
-                            {{ block }}
+ <footer class="footer text-left{% if not cfg.css_framework == 'MUNI' %} bg-secondary secondary-contrast-color{% endif %}">
+        <div class="{% if cfg.css_framework == 'MUNI' %}grid{% else %}row{% endif%} footer-margin">
+            {% if cfg.footer.sections[lang] is not none %}
+                {% for block in cfg.footer.sections[lang] %}
+                    {% if cfg.footer.format is not none and (cfg.footer.format == 'HTML' or cfg.footer.format == 'markdown') %}
+                        <div class="{% if cfg.css_framework == 'MUNI' %}grid__cell size--m--{{ colSize }}-4{% else %}col-padding-0 col-md-{{ colSize }}{% endif %}">
+                            {{ block |safe}}
                         </div>
                     {% else %}
-                        <div class="{% if css_framework == 'MUNI' %}grid__cell size--m--{{ colSize }}-4{% else %}col-padding-0 col-md-{{ colSize }}{% endif %}">
+                        <div class="{% if cfg.css_framework == 'MUNI' %}grid__cell size--m--{{ colSize }}-4{% else %}col-padding-0 col-md-{{ colSize }}{% endif %}">
                             {{ block }}
                         </div>
                     {% endif %}
                 {% endfor %}
             {% else %}
-                {% for block in sections %}
-                    {% if format is not none and (format == 'HTML' or format == 'markdown') %}
-                        <div class="{% if css_framework == 'MUNI' %}grid__cell size--m--{{ colSize }}-4{% else %}col-padding-0 col-md-{{ colSize }}{% endif %}">
-                            {{ block }}
+                {% for block in cfg.footer.sections %}
+                    {% if cfg.footer.format is not none and (cfg.footer.format == 'HTML' or cfg.footer.format == 'markdown') %}
+                        <div class="{% if cfg.css_framework == 'MUNI' %}grid__cell size--m--{{ colSize }}-4{% else %}col-padding-0 col-md-{{ colSize }}{% endif %}">
+                            {{ block |safe}}
                         </div>
                     {% else %}
-                        <div class="{% if css_framework == 'MUNI'%}grid__cell size--m--{{ colSize }}-4{% else %}col-padding-0 col-md-{{ colSize }}{% endif %}">
+                        <div class="{% if cfg.css_framework == 'MUNI'%}grid__cell size--m--{{ colSize }}-4{% else %}col-padding-0 col-md-{{ colSize }}{% endif %}">
                             {{ block }}
                         </div>
                     {% endif %}
diff --git a/templates/_header.html b/templates/_header.html
index 1c05f0de..4a214326 100644
--- a/templates/_header.html
+++ b/templates/_header.html
@@ -1,36 +1,36 @@
 <!DOCTYPE html>
-{% if css_framework == 'MUNI' %}
+{% if cfg.css_framework == 'MUNI' %}
     <header class="header">
         <div class="row-main header__wrap">
             <div class="grid">
                 <div class="grid__cell size--m--2-4 push--m--2-4 center">
                     <div class="header__side">
-                        {% if languages | length > 2 %}
+                        {% if cfg.languages | length > 2 %}
                             <nav class="menu-lang menu-lang--select" aria-label="{{ _('lang_selection') }}">
                                 <p class="menu-lang__selected">
-                                    {% if current_language is not none %}
+                                    {% if lang in cfg.languages %}
                                         <a href="#" class="menu-lang__selected__link">
-                                            {{ current_language }}
+                                            {{ cfg.languages[lang] }}
                                         </a>
                                     {% endif %}
                                 </p>
                                 <p class="menu-lang__popup">
-                                    {% for langKey, langName in languages.items() %}
-                                        {% if langName != current_language and currentUrl ~ "&language=" ~ langKey %}
-                                            <a href="{{ currentUrl ~ "?language=" ~ langKey }}{%- for name, value in queryParams.items() %}{{ "&" ~ name ~ "=" ~ value }}{%- endfor %}"
+                                    {% for langKey, langName in cfg.languages.items() %}
+                                        {% if langName != cfg.languages[lang] and request.base_url ~ "&lang=" ~ langKey %}
+                                            <a href="{{ request.base_url ~ "?lang=" ~ langKey }}{%- for name, value in request.args.items() %}{{ '' if name == "lang" else "&" ~ name ~ "=" ~ value }}{%- endfor %}"
                                                rel="alternate" hreflang="{{ langKey }}" lang="{{ langKey }}" class="menu-lang__popup__link">
                                                 {{ langName }}
                                             </a>
                                         {% endif %}
                                     {% endfor %}
-                                </p> b
+                                </p>
                             </nav>
                         {% else %}
                             <nav class="menu-lang" aria-label="{{ _('lang_selection') }}">
                                 <p class="menu-lang__selected">
-                                    {% for langKey, langName in languages.items() %}
-                                        {% if langName != current_language and currentUrl ~ "&language=" ~ langKey %}
-                                            <a href="{{ currentUrl ~ "?language=" ~ langKey }}{%- for name, value in queryParams.items() %}{{ "&" ~ name ~ "=" ~ value }}{%- endfor %}"
+                                    {% for langKey, langName in cfg.languages.items() %}
+                                        {% if langName != cfg.languages[lang] and request.base_url ~ "&lang=" ~ langKey %}
+                                            <a href="{{ request.base_url ~ "?lang=" ~ langKey }}{%- for name, value in request.args.items() %}{{ '' if name == "lang" else "&" ~ name ~ "=" ~ value }}{%- endfor %}"
                                                rel="alternate" hreflang="{{ langKey }}" lang="{{ langKey }}" class="menu-lang__selected__link">
                                                 {{ langName }}
                                             </a>
@@ -44,10 +44,10 @@
                                 <div class="row-main">
                                     <ul class="menu-mobile__list">
                                         {% set counter = 0 %}
-                                        {% for langKey, langName in languages.items() %}
-                                            {% if counter < 5 and langName != current_language and currentUrl ~ "&language=" ~ langKey %}
+                                        {% for langKey, langName in cfg.languages.items() %}
+                                            {% if counter < 5 and langName != cfg.languages[lang] and request.base_url ~ "&lang=" ~ langKey %}
                                                 <li class="menu-mobile__item">
-                                                    <a href="{{ currentUrl ~ "?language=" ~ langKey }}{%- for name, value in queryParams.items() %}{{ "&" ~ name ~ "=" ~ value }}{%- endfor %}"
+                                                    <a href="{{ request.base_url ~ "?lang=" ~ langKey }}{%- for name, value in request.args.items() %}{{ '' if name == "lang" else "&" ~ name ~ "=" ~ value }}{%- endfor %}"
                                                        rel="alternate" hreflang="{{ langKey }}" lang="{{ langKey }}" class="menu-mobile__link menu-mobile__link--lang">
                                                         {{ langKey|upper }}
                                                     </a>
@@ -62,7 +62,7 @@
                     </div>
                 </div>
                 <div class="grid__cell size--m--2-4 pull--m--2-4 center">
-                    <img src="{% if logo is not none %}{{ logo }}{% endif %}" class="header-img" alt="{% if name is not none %}{{ name }}{% endif %}"/>
+                    <img src="{% if cfg.logo is not none %}{{ cfg.logo }}{% endif %}" class="header-img" alt="{% if cfg.name is not none %}{{ cfg.name }}{% endif %}"/>
                 </div>
             </div>
         </div>
@@ -72,20 +72,20 @@
         <div class="container">
             <div class="row">
                 <div class="col-md-6 order-md-last text-md-end">
-                    {% if languages | length > 2 %}
+                    {% if cfg.languages | length > 2 %}
                         <div class="dropdown language-bar mt-3">
                             <a id="dropdown-language" class="btn btn-secondary dropdown-toggle text-primary bg-white border-0" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
-                                {% if current_language is not none %}
-                                    <span class="d-md-none">{{ current_language | upper }}</span><span class="d-none d-md-inline">{{ attribute(languages, current_language) }}</span>
+                                {% if lang in cfg.languages %}
+                                    <span class="d-md-none">{{ cfg.languages[lang] | upper }}</span><span class="d-none d-md-inline">{{ cfg.languages[lang] }}</span>
                                 {% else %}
                                     {{ current_language | upper }}
                                 {% endif %}
                             </a>
                             <ul class="dropdown-menu" aria-labelledby="dropdown-language">
-                                {% for langKey, langName in languages.items() %}
-                                    {% if langName != current_language %}
+                                {% for langKey, langName in cfg.languages.items() %}
+                                    {% if langName != cfg.languages[lang] %}
                                         <li>
-                                            <a class="dropdown-item text-primary" href="{{ currentUrl ~ "?language=" ~ langKey }}{%- for name, value in queryParams.items() %}{{ "&" ~ name ~ "=" ~ value }}{%- endfor %}">
+                                            <a class="dropdown-item text-primary" href="{{ request.base_url ~ "?lang=" ~ langKey }}{%- for name, value in request.args.items() %}{{ '' if name == "lang" else "&" ~ name ~ "=" ~ value }}{%- endfor %}">
                                                 <span class="d-md-none">{{ langKey | upper }}</span><span class="d-none d-md-inline">{{ langName }}</span>
                                             </a>
                                         </li>
@@ -95,9 +95,9 @@
                         </div>
                     {% else %}
                         <p class="language-bar mt-3">
-                            {% for langKey, langName in languages.items() %}
-                                {% if langName != current_language and currentUrl ~ "&language=" ~ langKey %}
-                                    <a href="{{ currentUrl ~ "?language=" ~ langKey }}{%- for name, value in queryParams.items() %}{{ "&" ~ name ~ "=" ~ value }}{%- endfor %}"
+                            {% for langKey, langName in cfg.languages.items() %}
+                                {% if langName != cfg.languages[lang] and request.base_url ~ "&lang=" ~ langKey %}
+                                    <a href="{{ request.base_url ~ "?lang=" ~ langKey }}{%- for name, value in request.args.items() %}{{ '' if name == "lang" else "&" ~ name ~ "=" ~ value }}{%- endfor %}"
                                        rel="alternate" hreflang="{{ langKey }}" lang="{{ langKey }}" class="text-decoration-none text-primary">
                                         <span class="d-md-none">{{ langKey | upper }}</span><span class="d-none d-md-inline">{{ langName }}</span>
                                     </a>
@@ -107,7 +107,7 @@
                     {% endif %}
                 </div>
                 <div class="col-md-6 order-md-first text-md-start">
-                    <img src="{% if logo is not none %}{{ logo }}{% endif %}" class="header-img mt-3" alt="{% if name is not none %}{{ name }}{% endif %}"/>
+                    <img src="{% if cfg.logo is not none %}{{ cfg.logo }}{% endif %}" class="header-img mt-3" alt="{% if cfg.name is not none %}{{ cfg.name }}{% endif %}"/>
                 </div>
             </div>
         </div>
diff --git a/templates/authorization.html b/templates/authorization.html
index 79f28044..c08054e1 100644
--- a/templates/authorization.html
+++ b/templates/authorization.html
@@ -4,10 +4,10 @@
 <title>Authorization page</title>
 {% endblock %}
 
-{% block body %}
+{% block content %}
 <div class="content">
-    <h1 style="text-align: center">Authorization page</h1>
-    <h1 style="text-align: center"><span>{{ _('service') }}</span>: {{service}}</h1>
-    <h1 style="text-align: center">email: {{email}}</h1>
+    <h1 style="text-align: center"><span>{{ _("You are not authorized to access the service ") }}</span> <span>{{ _("service") }}</span></h1>
+    <h1 style="text-align: center"><span>{{ _('We will now redirect you to a registration page, where you will apply for the access.') }}</span></h1>
+    <h1 style="text-align: center"> <a href="{{ registration_url }}"><span>{{ _("Proceed to registration") }}</span></a></h1>
 </div>
 {% endblock %}
\ No newline at end of file
diff --git a/templates/base.html b/templates/base.html
index 4d54fa4f..5aa9de53 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -8,14 +8,14 @@
     {# skip default CSS, favicon and JavaScript #}
     <meta name="robots" content="noindex, nofollow">
     {% block preload %}
-      {% if css_framework == 'MUNI' %}
-        <link rel="stylesheet" type="text/css" href="/static/MuniWeb/css/style{% if faculty is not none%}-{{ faculty }}{% endif %}.css" />
+      {% if cfg.css_framework == 'MUNI' %}
+        <link rel="stylesheet" type="text/css" href="/static/MuniWeb/css/style{% if cfg.MUNI_faculty is not none%}-{{ cfg.MUNI_faculty }}{% endif %}.css" />
       {% else %}
         <link href="/static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
       {% endif %}
     {% endblock %}
   </head>
-  <body id="{{ templateId }}" class="{% if css_framework == 'MUNI'  %}framework_muni{% else %}framework_bootstrap5{% endif %}">
+  <body id="{{ templateId }}" class="{% if cfg.css_framework == 'MUNI'  %}framework_muni{% else %}framework_bootstrap5{% endif %}">
     <div id="layout">
       {% block header %}{% include "_header.html" %}{% endblock %}
       {% block contentwrapper %}
@@ -31,7 +31,7 @@
       {% block footer %}{% include "_footer.html" %}{% endblock %}
     </div>
     {% block postload %}
-      {% if css_framework == 'MUNI' %}
+      {% if cfg.css_framework == 'MUNI' %}
         <script src="/static/jquery-3.6.0.min.js"></script>
         <script src="/static/MuniWeb/js/app.js"></script>
         <script src="/static/campus-idp-muni.js"></script>
diff --git a/translations/cs/LC_MESSAGES/messages.po b/translations/cs/LC_MESSAGES/messages.po
new file mode 100644
index 00000000..9386759a
--- /dev/null
+++ b/translations/cs/LC_MESSAGES/messages.po
@@ -0,0 +1,61 @@
+# Czech translations for PROJECT.
+# Copyright (C) 2022 ORGANIZATION
+# This file is distributed under the same license as the PROJECT project.
+# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
+"POT-Creation-Date: 2022-09-19 01:27+0200\n"
+"PO-Revision-Date: 2022-09-12 21:11+0200\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language: cs\n"
+"Language-Team: cs <LL@li.org>\n"
+"Plural-Forms: nplurals=3; plural=((n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2);\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Generated-By: Babel 2.10.3\n"
+
+#: app.py:67
+msgid "fail"
+msgstr "selhání"
+
+#: app.py:67
+msgid "Missing request parameter"
+msgstr "Chybí požadovaný parametr"
+
+#: templates/IsTestingSP.html:9
+msgid "You are about to access service, which is in testing environment."
+msgstr "Přistupujete ke službě, která je v testovacím režimu."
+
+#: templates/IsTestingSP.html:10
+msgid "Continue"
+msgstr "Pokračovat"
+
+#: templates/SPAuthorization.html:9 templates/authorization.html:9
+msgid "You are not authorized to access the service "
+msgstr "Nesplňujete autorizační pravidla pro přístup ke službě "
+
+#: templates/SPAuthorization.html:9 templates/authorization.html:9
+msgid "service"
+msgstr "služba"
+
+#: templates/SPAuthorization.html:10 templates/authorization.html:10
+msgid ""
+"We will now redirect you to a registration page, where you will apply for"
+" the access."
+msgstr "Budete přesmerován(a) na stránku, kde můžete o p%rístup na službu zažádat."
+
+#: templates/SPAuthorization.html:11 templates/authorization.html:11
+msgid "Proceed to registration"
+msgstr "Pokračovat na registrační stránk"
+
+#: templates/_header.html:9 templates/_header.html:29
+msgid "lang_selection"
+msgstr ""
+
+#: templates/_header.html:42
+msgid "mobile_lang_selection"
+msgstr ""
-- 
GitLab