mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
i18n: support for languageDirection #733
This commit is contained in:
parent
42b604b4fb
commit
9227dfd41f
6 changed files with 6 additions and 5 deletions
|
@ -124,6 +124,7 @@ title = "Hugo Relearn Theme"
|
||||||
title = "Cap'n Hugo Relearrrn Theme"
|
title = "Cap'n Hugo Relearrrn Theme"
|
||||||
weight = 2
|
weight = 2
|
||||||
languageCode = "art-pir"
|
languageCode = "art-pir"
|
||||||
|
languageDirection = "rtl"
|
||||||
languageName = "Arrr! ☠ Pirrrates ☠"
|
languageName = "Arrr! ☠ Pirrrates ☠"
|
||||||
# Language dependend settings:
|
# Language dependend settings:
|
||||||
# Use case https://gohugo.io/content-management/multilingual/#translation-by-content-directory
|
# Use case https://gohugo.io/content-management/multilingual/#translation-by-content-directory
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[Reading-direction]
|
[Reading-direction]
|
||||||
other = "rtl"
|
other = "ltr"
|
||||||
|
|
||||||
[Search]
|
[Search]
|
||||||
other = "Searrrch"
|
other = "Searrrch"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
{{- partialCached "page-meta.hugo" . .RelPermalink }}
|
{{- partialCached "page-meta.hugo" . .RelPermalink }}
|
||||||
{{- $outputFormat := partial "output-format.hugo" . }}
|
{{- $outputFormat := partial "output-format.hugo" . }}
|
||||||
<html lang="{{ .Page.Language.LanguageCode | default "en" }}" dir="{{ T "Reading-direction" | default "ltr" }}">
|
<html lang="{{ .Page.Language.LanguageCode | default "en" }}" dir="{{ .Page.Language.LanguageDirection | default (T "Reading-direction") | default "ltr" }}">
|
||||||
<head>
|
<head>
|
||||||
{{- partial "meta.html" . }}
|
{{- partial "meta.html" . }}
|
||||||
{{- $title := .Title }}
|
{{- $title := .Title }}
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
{{- errorf "The Relearn theme requires Hugo %s or later" $hugoVersion }}
|
{{- errorf "The Relearn theme requires Hugo %s or later" $hugoVersion }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<html lang="{{ .Page.Language.LanguageCode | default "en" }}" dir="{{ T "Reading-direction" | default "ltr" }}">
|
<html lang="{{ .Page.Language.LanguageCode | default "en" }}" dir="{{ .Page.Language.LanguageDirection | default (T "Reading-direction") | default "ltr" }}">
|
||||||
<head>
|
<head>
|
||||||
{{- partial "meta.html" . }}
|
{{- partial "meta.html" . }}
|
||||||
{{- $page := . }}
|
{{- $page := . }}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
|
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
|
||||||
{{- if and (or (eq $outputFormat "html") (eq $outputFormat "searchpage")) $showPrevNext }}
|
{{- if and (or (eq $outputFormat "html") (eq $outputFormat "searchpage")) $showPrevNext }}
|
||||||
{{- $endarrow := "🡒" }}
|
{{- $endarrow := "🡒" }}
|
||||||
{{- if eq (T "Reading-direction" | default "ltr") "rtl" }}
|
{{- if eq (.Language.LanguageDirection | default (T "Reading-direction") | default "ltr") "rtl" }}
|
||||||
{{- $endarrow = "🡐" }}
|
{{- $endarrow = "🡐" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $next := "" }}
|
{{- $next := "" }}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
|
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
|
||||||
{{- if and (or (eq $outputFormat "html") (eq $outputFormat "searchpage")) $showPrevNext }}
|
{{- if and (or (eq $outputFormat "html") (eq $outputFormat "searchpage")) $showPrevNext }}
|
||||||
{{- $startarrow := "🡐" }}
|
{{- $startarrow := "🡐" }}
|
||||||
{{- if eq (T "Reading-direction" | default "ltr") "rtl" }}
|
{{- if eq (.Language.LanguageDirection | default (T "Reading-direction") | default "ltr") "rtl" }}
|
||||||
{{- $startarrow = "🡒" }}
|
{{- $startarrow = "🡒" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $prev := "" }}
|
{{- $prev := "" }}
|
||||||
|
|
Loading…
Reference in a new issue