aboutsummaryrefslogtreecommitdiff
path: root/layouts
diff options
context:
space:
mode:
authorAlex Ivanov <ai@contributor.pw>2019-11-10 01:27:11 +0300
committerAlex Shpak <alex-shpak@users.noreply.github.com>2019-11-16 20:34:46 +0100
commit9cd378a2d27ad4c9cb2e46d12022e68e23f96ea7 (patch)
tree7ed204e6b8781a9d92175de669b812efc5fe8733 /layouts
parent890cc000bbe3d5c6058de507e57dc8a4ab095f23 (diff)
Multilang (#93)
* Add i18n langs trans example * partials * Update sample site * cc of variables of config * Clean PR * revert master data
Diffstat (limited to 'layouts')
-rw-r--r--layouts/partials/docs/language-switch.html14
-rw-r--r--layouts/partials/docs/menu.html5
-rw-r--r--layouts/partials/docs/translation-switch.html14
3 files changed, 33 insertions, 0 deletions
diff --git a/layouts/partials/docs/language-switch.html b/layouts/partials/docs/language-switch.html
new file mode 100644
index 0000000..4a84ade
--- /dev/null
+++ b/layouts/partials/docs/language-switch.html
@@ -0,0 +1,14 @@
+{{ if .Site.IsMultiLingual }}
+<ul>
+ <li class="book-section-flat">
+ <span>{{ i18n "languages" }}</span>
+ <ul>
+ {{ range .Site.Home.AllTranslations -}}
+ <li>
+ <a href="{{ .Permalink }}" class="{{ if (eq $.Site.Language .Language ) }}active{{ end }}">{{ .Language.LanguageName }}</a>
+ </li>
+ {{- end }}
+ </ul>
+ </li>
+</ul>
+{{ end }}
diff --git a/layouts/partials/docs/menu.html b/layouts/partials/docs/menu.html
index 6a72ac9..3d04b04 100644
--- a/layouts/partials/docs/menu.html
+++ b/layouts/partials/docs/menu.html
@@ -10,6 +10,11 @@
{{ end }}
{{ partial "docs/inject/menu-after" . }}
+
+{{ if .Site.IsMultiLingual }}
+ {{ partial "docs/translation-switch" . }}
+ {{ partial "docs/language-switch" . }}
+{{ end }}
</nav>
<!-- Restore menu position as soon as possible to avoid flickering -->
diff --git a/layouts/partials/docs/translation-switch.html b/layouts/partials/docs/translation-switch.html
new file mode 100644
index 0000000..4ad0f1a
--- /dev/null
+++ b/layouts/partials/docs/translation-switch.html
@@ -0,0 +1,14 @@
+{{ if .IsTranslated }}
+<ul>
+ <li class="book-section-flat">
+ <span>{{ i18n "translations" }}</span>
+ <ul>
+ {{ range .Translations }}
+ <li>
+ <a href="{{ .Permalink }}">{{ .Lang }}: {{ .Title }}{{ if .IsPage }} ({{ i18n "wordCount" . }}){{ end }}</a>
+ </li>
+ {{ end }}
+ </ul>
+ </li>
+</ul>
+{{ end }} \ No newline at end of file