i18n: support for languageDirection #733

This commit is contained in:
Sören Weber 2023-11-28 21:39:50 +01:00
parent 42b604b4fb
commit 9227dfd41f
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
6 changed files with 6 additions and 5 deletions

View file

@ -124,6 +124,7 @@ title = "Hugo Relearn Theme"
title = "Cap'n Hugo Relearrrn Theme"
weight = 2
languageCode = "art-pir"
languageDirection = "rtl"
languageName = "Arrr! ☠ Pirrrates ☠"
# Language dependend settings:
# Use case https://gohugo.io/content-management/multilingual/#translation-by-content-directory

View file

@ -1,5 +1,5 @@
[Reading-direction]
other = "rtl"
other = "ltr"
[Search]
other = "Searrrch"

View file

@ -1,7 +1,7 @@
<!DOCTYPE html>
{{- partialCached "page-meta.hugo" . .RelPermalink }}
{{- $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>
{{- partial "meta.html" . }}
{{- $title := .Title }}

View file

@ -11,7 +11,7 @@
{{- errorf "The Relearn theme requires Hugo %s or later" $hugoVersion }}
{{- 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>
{{- partial "meta.html" . }}
{{- $page := . }}

View file

@ -7,7 +7,7 @@
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
{{- if and (or (eq $outputFormat "html") (eq $outputFormat "searchpage")) $showPrevNext }}
{{- $endarrow := "🡒" }}
{{- if eq (T "Reading-direction" | default "ltr") "rtl" }}
{{- if eq (.Language.LanguageDirection | default (T "Reading-direction") | default "ltr") "rtl" }}
{{- $endarrow = "🡐" }}
{{- end }}
{{- $next := "" }}

View file

@ -7,7 +7,7 @@
{{- $showPrevNext := (and (not .Params.disableNextPrev) (not .Site.Params.disableNextPrev)) }}
{{- if and (or (eq $outputFormat "html") (eq $outputFormat "searchpage")) $showPrevNext }}
{{- $startarrow := "🡐" }}
{{- if eq (T "Reading-direction" | default "ltr") "rtl" }}
{{- if eq (.Language.LanguageDirection | default (T "Reading-direction") | default "ltr") "rtl" }}
{{- $startarrow = "🡒" }}
{{- end }}
{{- $prev := "" }}