From 3242ca974e2bab5bd787c763b132d8e986f3273c Mon Sep 17 00:00:00 2001 From: squidfunk Date: Wed, 4 Mar 2020 22:06:05 +0100 Subject: [PATCH] Refactored template localization --- src/base.html | 8 ++++---- src/partials/language.html | 4 +--- src/partials/language/ar.html | 1 - src/partials/language/ca.html | 1 - src/partials/language/et.html | 1 - src/partials/language/fa.html | 1 - src/partials/language/gr.html | 1 - src/partials/language/he.html | 1 - src/partials/language/hi.html | 1 - src/partials/language/hr.html | 1 - src/partials/language/id.html | 1 - src/partials/language/pl.html | 1 - src/partials/language/si.html | 1 - src/partials/language/sk.html | 1 - src/partials/language/sr.html | 1 - src/partials/toc.html | 10 +++++----- 16 files changed, 10 insertions(+), 25 deletions(-) diff --git a/src/base.html b/src/base.html index 789d7d05d..e6c278a4a 100644 --- a/src/base.html +++ b/src/base.html @@ -169,16 +169,17 @@ + {% set direction = config.theme.direction | default(lang.t('direction')) %} {% if palette.primary or palette.accent %} {% set primary = palette.primary | replace(" ", "-") | lower %} {% set accent = palette.accent | replace(" ", "-") | lower %} {% else %} - + {% endif %} -{% macro t(key) %}{{ { - "direction": config.theme.direction -}[key] or lang.t(key) or fallback.t(key) }}{% endmacro %} +{% macro t(key) %}{{ lang.t(key) | default(fallback.t(key)) }}{% endmacro %} diff --git a/src/partials/language/ar.html b/src/partials/language/ar.html index 60e90c82c..abb703def 100644 --- a/src/partials/language/ar.html +++ b/src/partials/language/ar.html @@ -31,7 +31,6 @@ "footer.next": "التالية", "meta.comments": "التعليقات", "meta.source": "المصدر", - "search.language": "", "search.pipeline": "", "search.placeholder": "بحث", "search.result.placeholder": "اكتب لبدء البحث", diff --git a/src/partials/language/ca.html b/src/partials/language/ca.html index 1b39ad521..ac45cf5b2 100644 --- a/src/partials/language/ca.html +++ b/src/partials/language/ca.html @@ -30,7 +30,6 @@ "footer.next": "Següent", "meta.comments": "Comentaris", "meta.source": "Codi font", - "search.language": "", "search.placeholder": "Cerca", "search.result.placeholder": "Escriu per a començar a cercar", "search.result.none": "Cap document coincideix", diff --git a/src/partials/language/et.html b/src/partials/language/et.html index 2e87d5599..7a622b7a7 100644 --- a/src/partials/language/et.html +++ b/src/partials/language/et.html @@ -30,7 +30,6 @@ "footer.next": "Järgmine", "meta.comments": "Kommentaarid", "meta.source": "Lähtekood", - "search.language": "", "search.pipeline": "", "search.placeholder": "Otsi", "search.result.placeholder": "Otsimiseks kirjuta siia", diff --git a/src/partials/language/fa.html b/src/partials/language/fa.html index 6d10fc6c2..5958a5c5b 100644 --- a/src/partials/language/fa.html +++ b/src/partials/language/fa.html @@ -31,7 +31,6 @@ "footer.next": "بعدی", "meta.comments": "نظرات", "meta.source": "منبع", - "search.language": "", "search.pipeline": "", "search.placeholder": "جستجو", "search.result.placeholder": "برای شروع جستجو تایپ کنید", diff --git a/src/partials/language/gr.html b/src/partials/language/gr.html index e3ed4f05a..6539a6cfa 100644 --- a/src/partials/language/gr.html +++ b/src/partials/language/gr.html @@ -30,7 +30,6 @@ "footer.next": "Προηγούμενη", "meta.comments": "Σχόλια", "meta.source": "Πηγή", - "search.language": "", "search.pipeline": "", "search.placeholder": "Αναζήτηση", "search.result.placeholder": "Πληκτρολογήστε για να αρχίσει η αναζήτηση", diff --git a/src/partials/language/he.html b/src/partials/language/he.html index db343c17b..9859b5bed 100644 --- a/src/partials/language/he.html +++ b/src/partials/language/he.html @@ -31,7 +31,6 @@ "footer.next": "הַבָּא", "meta.comments": "הערות", "meta.source": "מָקוֹר", - "search.language": "", "search.pipeline": "", "search.placeholder": "לחפש", "search.result.placeholder": "הקלד כדי להתחיל לחפש", diff --git a/src/partials/language/hi.html b/src/partials/language/hi.html index f146ec5cf..aadb052a3 100644 --- a/src/partials/language/hi.html +++ b/src/partials/language/hi.html @@ -30,7 +30,6 @@ "footer.next": "आगामी", "meta.comments": "टिप्पणियाँ", "meta.source": "स्रोत", - "search.language": "", "search.pipeline": "", "search.placeholder": "खोज", "search.result.placeholder": "खोज शुरू करने के लिए टाइप करें", diff --git a/src/partials/language/hr.html b/src/partials/language/hr.html index f242547b5..23c90b6b8 100644 --- a/src/partials/language/hr.html +++ b/src/partials/language/hr.html @@ -30,7 +30,6 @@ "footer.next": "Sljedeće", "meta.comments": "Komentari", "meta.source": "Izvor", - "search.language": "", "search.pipeline": "", "search.placeholder": "Pretraživanje", "search.result.placeholder": "Unesite pojam pretraživanja", diff --git a/src/partials/language/id.html b/src/partials/language/id.html index b6f250419..7e28ba3b2 100644 --- a/src/partials/language/id.html +++ b/src/partials/language/id.html @@ -30,7 +30,6 @@ "footer.next": "Selanjutnya", "meta.comments": "Komentar", "meta.source": "Sumber", - "search.language": "", "search.pipeline": "", "search.placeholder": "Cari", "search.result.placeholder": "Ketik untuk mulai pencarian", diff --git a/src/partials/language/pl.html b/src/partials/language/pl.html index 3be29e899..12e41665d 100755 --- a/src/partials/language/pl.html +++ b/src/partials/language/pl.html @@ -30,7 +30,6 @@ "footer.next": "Następna strona", "meta.comments": "Komentarze", "meta.source": "Kod źródłowy", - "search.language": "", "search.pipeline": "", "search.placeholder": "Szukaj", "search.result.placeholder": "Zacznij pisać, aby szukać", diff --git a/src/partials/language/si.html b/src/partials/language/si.html index e8068bc43..63f3ec8c9 100644 --- a/src/partials/language/si.html +++ b/src/partials/language/si.html @@ -30,7 +30,6 @@ "footer.next": "Naslednja stran", "meta.comments": "Komentarji", "meta.source": "Izvorna koda", - "search.language": "", "search.placeholder": "Išči", "search.result.placeholder": "Vpiši iskalni niz", "search.result.none": "Ni zadetkov", diff --git a/src/partials/language/sk.html b/src/partials/language/sk.html index facf94a32..20d2c4eb3 100644 --- a/src/partials/language/sk.html +++ b/src/partials/language/sk.html @@ -30,7 +30,6 @@ "footer.next": "Ďalej", "meta.comments": "Komentáre", "meta.source": "Zdroj", - "search.language": "", "search.placeholder": "Hľadať", "search.result.placeholder": "Pre vyhľadávanie začni písať", "search.result.none": "Žiadne vyhovujúce dokumenty", diff --git a/src/partials/language/sr.html b/src/partials/language/sr.html index 44ec8c366..606397f4c 100644 --- a/src/partials/language/sr.html +++ b/src/partials/language/sr.html @@ -30,7 +30,6 @@ "footer.next": "Следеће", "meta.comments": "Коментари", "meta.source": "Извор", - "search.language": "", "search.pipeline": "", "search.placeholder": "Претрага", "search.result.placeholder": "Унесите појам претраге", diff --git a/src/partials/toc.html b/src/partials/toc.html index 83444a9ef..d55ee666a 100644 --- a/src/partials/toc.html +++ b/src/partials/toc.html @@ -24,7 +24,7 @@