1
0
mirror of https://github.com/alanorth/hugo-theme-bootstrap4-blog.git synced 2024-11-24 13:10:18 +01:00

Localize "by" and "in" strings in post meta

This became a problem when I added right-to-left language support.
When you mix RTL languages like Arabic with English (even for just
dates and small strings) everything becomes jumbled. For now I have
only added translations for English (default), Arabic, and Bulgarian.
This commit is contained in:
Alan Orth 2019-04-22 18:51:33 +03:00
parent 9da05e7869
commit b862745a0d
Signed by: alanorth
GPG Key ID: 0FB860CC9C45B1B9
7 changed files with 32 additions and 8 deletions

View File

@ -36,3 +36,12 @@
- id: links - id: links
translation: "الرَِّوَابِط" translation: "الرَِّوَابِط"
- id: authoredBy
translation: "الكاتب"
- id: postedIn
translation: "في"
- id: comma
translation: "،"

View File

@ -36,3 +36,9 @@
- id: links - id: links
translation: "Линкове" translation: "Линкове"
- id: authoredBy
translation: "от"
- id: postedIn
translation: "в"

View File

@ -36,3 +36,12 @@
- id: links - id: links
translation: "Links" translation: "Links"
- id: authoredBy
translation: "by"
- id: postedIn
translation: "in"
- id: comma
translation: ","

View File

@ -2,8 +2,8 @@
<article class="blog-post"> <article class="blog-post">
<header> <header>
<h2 class="blog-post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2> <h2 class="blog-post-title" dir="auto"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2>
<p class="blog-post-meta"><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format $dateFormat }}</time> by {{ .Params.author | default .Site.Params.author }}{{ if or (.Params.categories) (.Params.tags) }} in {{ partial "meta-terms.html" . }}{{ end }}</p> <p class="blog-post-meta"><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format $dateFormat }}</time> {{ i18n "authoredBy" }} {{ .Params.author | default .Site.Params.author }}{{ if or (.Params.categories) (.Params.tags) }} {{ i18n "postedIn" }} {{ partial "meta-terms.html" . }}{{ end }}</p>
</header> </header>
{{ .Content }} {{ .Content }}
</article> <!-- /.blog-post --> </article> <!-- /.blog-post -->

View File

@ -58,8 +58,8 @@
<article class="blog-post"> <article class="blog-post">
<header> <header>
<h2 class="blog-post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2> <h2 class="blog-post-title" dir="auto"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2>
<p class="blog-post-meta"><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format $dateFormat }}</time> by {{ .Params.author | default .Site.Params.author }}{{ if or (.Params.categories) (.Params.tags) }} in {{ partial "meta-terms.html" . }}{{ end }}</p> <p class="blog-post-meta"><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format $dateFormat }}</time> {{ i18n "authoredBy" }} {{ .Params.author | default .Site.Params.author }}{{ if or (.Params.categories) (.Params.tags) }} {{ i18n "postedIn" }} {{ partial "meta-terms.html" . }}{{ end }}</p>
</header> </header>
{{ .Content }} {{ .Content }}

View File

@ -2,8 +2,8 @@
<article class="blog-post"> <article class="blog-post">
<header> <header>
<h2 class="blog-post-title"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2> <h2 class="blog-post-title" dir="auto"><a href="{{ .Permalink }}">{{ .Title | markdownify }}</a></h2>
<p class="blog-post-meta"><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format $dateFormat }}</time> by {{ .Params.author | default .Site.Params.author }}{{ if or (.Params.categories) (.Params.tags) }} in {{ partial "meta-terms.html" . }}{{ end }}</p> <p class="blog-post-meta"><time datetime="{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}">{{ .Date.Format $dateFormat }}</time> {{ i18n "authoredBy" }} {{ .Params.author | default .Site.Params.author }}{{ if or (.Params.categories) (.Params.tags) }} {{ i18n "postedIn" }} {{ partial "meta-terms.html" . }}{{ end }}</p>
</header> </header>
{{ .Summary }} {{ .Summary }}
<a href='{{ .Permalink }}'>{{ i18n "readMore" }}</a> <a href='{{ .Permalink }}'>{{ i18n "readMore" }}</a>

View File

@ -1,8 +1,8 @@
{{ if .Params.categories }} {{ if .Params.categories }}
<i class="fa fa-folder" aria-hidden="true"></i>&nbsp;{{ range $index, $category := .Params.categories }}{{ if gt $index 0 }}, {{ end }}<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}" rel="category tag">{{ . }}</a>{{ end }} <i class="fa fa-folder" aria-hidden="true"></i>&nbsp;{{ range $index, $category := .Params.categories }}{{ if gt $index 0 }}{{ i18n "comma" }} {{ end }}<a href="{{ "/categories/" | relLangURL }}{{ . | urlize }}" rel="category tag">{{ . }}</a>{{ end }}
{{ end }} {{ end }}
{{ if .Params.tags }} {{ if .Params.tags }}
<i class="fa fa-tag" aria-hidden="true"></i>&nbsp;{{ range $index, $tag := .Params.tags }}{{ if gt $index 0 }}, {{ end }}<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}" rel="tag">{{ . }}</a>{{ end }} <i class="fa fa-tag" aria-hidden="true"></i>&nbsp;{{ range $index, $tag := .Params.tags }}{{ if gt $index 0 }}{{ i18n "comma" }} {{ end }}<a href="{{ "/tags/" | relLangURL }}{{ . | urlize }}" rel="tag">{{ . }}</a>{{ end }}
{{ end }} {{ end }}
{{- /* vim: set ts=2 sw=2 et: */}} {{- /* vim: set ts=2 sw=2 et: */}}