Refactored template localization

This commit is contained in:
squidfunk 2020-03-04 22:06:05 +01:00
parent 66376bbe8c
commit 3242ca974e
16 changed files with 10 additions and 25 deletions

View File

@ -169,16 +169,17 @@
</head>
<!-- Text direction and color palette, if defined -->
{% 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 %}
<body
dir="{{ lang.t('direction') }}"
dir="{{ direction }}"
data-md-color-primary="{{ primary }}"
data-md-color-accent="{{ accent }}"
>
{% else %}
<body dir="{{ lang.t('direction') }}">
<body dir="{{ direction }}">
{% endif %}
<!--
@ -380,8 +381,7 @@
"clipboard.copy",
"clipboard.copied",
"search.language",
"search.pipeline.stopwords",
"search.pipeline.trimmer",
"search.pipeline",
"search.result.placeholder",
"search.result.none",
"search.result.one",

View File

@ -27,6 +27,4 @@
{% import "partials/language/en.html" as fallback %}
<!-- Re-export translations -->
{% 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 %}

View File

@ -31,7 +31,6 @@
"footer.next": "التالية",
"meta.comments": "التعليقات",
"meta.source": "المصدر",
"search.language": "",
"search.pipeline": "",
"search.placeholder": "بحث",
"search.result.placeholder": "اكتب لبدء البحث",

View File

@ -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",

View File

@ -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",

View File

@ -31,7 +31,6 @@
"footer.next": "بعدی",
"meta.comments": "نظرات",
"meta.source": "منبع",
"search.language": "",
"search.pipeline": "",
"search.placeholder": "جستجو",
"search.result.placeholder": "برای شروع جستجو تایپ کنید",

View File

@ -30,7 +30,6 @@
"footer.next": "Προηγούμενη",
"meta.comments": "Σχόλια",
"meta.source": "Πηγή",
"search.language": "",
"search.pipeline": "",
"search.placeholder": "Αναζήτηση",
"search.result.placeholder": "Πληκτρολογήστε για να αρχίσει η αναζήτηση",

View File

@ -31,7 +31,6 @@
"footer.next": "הַבָּא",
"meta.comments": "הערות",
"meta.source": "מָקוֹר",
"search.language": "",
"search.pipeline": "",
"search.placeholder": "לחפש",
"search.result.placeholder": "הקלד כדי להתחיל לחפש",

View File

@ -30,7 +30,6 @@
"footer.next": "आगामी",
"meta.comments": "टिप्पणियाँ",
"meta.source": "स्रोत",
"search.language": "",
"search.pipeline": "",
"search.placeholder": "खोज",
"search.result.placeholder": "खोज शुरू करने के लिए टाइप करें",

View File

@ -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",

View File

@ -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",

View File

@ -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ć",

View File

@ -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",

View File

@ -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",

View File

@ -30,7 +30,6 @@
"footer.next": "Следеће",
"meta.comments": "Коментари",
"meta.source": "Извор",
"search.language": "",
"search.pipeline": "",
"search.placeholder": "Претрага",
"search.result.placeholder": "Унесите појам претраге",

View File

@ -24,7 +24,7 @@
<!-- Table of contents -->
<nav class="md-nav md-nav--secondary">
{% set toc_ = page.toc %}
{% set toc = page.toc %}
<!--
Hack: check whether the content contains a h1 headline. If it does, the
@ -32,12 +32,12 @@
to the current page that is located just above the anchor. Therefore we
directly continue with the children of the anchor.
-->
{% if toc_ | first is defined and "\x3ch1 id=" in page.content %}
{% set toc_ = (toc_ | first).children %}
{% if toc | first is defined and "\x3ch1 id=" in page.content %}
{% set toc = (toc | first).children %}
{% endif %}
<!-- Render item list -->
{% if toc_ | first is defined %}
{% if toc | first is defined %}
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon">
{% include ".icons/material/arrow-left.svg" %}
@ -45,7 +45,7 @@
{{ lang.t("toc.title") }}
</label>
<ul class="md-nav__list" data-md-scrollfix>
{% for toc_item in toc_ %}
{% for toc_item in toc %}
{% include "partials/toc-item.html" %}
{% endfor %}
</ul>