diff options
author | Rise <8315221+AmazingRise@users.noreply.github.com> | 2020-05-24 14:30:16 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-24 14:30:16 +0300 |
commit | 7a992cd63c37372eaf23485d1ca5f3a3d72f03a3 (patch) | |
tree | dc03b01a7babf427fde3dbf7fce977f5b4273882 | |
parent | adace134fe0c3f79af844eb56e4d03ae7323361b (diff) | |
parent | 80528202e2b0cc0a643d37e539ed91132d6e5a1d (diff) |
Merge pull request #43 from jordan-dlh/i18n-functionality
Internationalization, add English and French translations.
-rw-r--r-- | i18n/en.yaml | 28 | ||||
-rw-r--r-- | i18n/fr.yaml | 28 | ||||
-rw-r--r-- | layouts/_default/single.html | 14 | ||||
-rw-r--r-- | layouts/partials/comment.html | 4 | ||||
-rw-r--r-- | layouts/partials/copyright.html | 6 | ||||
-rw-r--r-- | layouts/partials/post-item-meta.html | 6 | ||||
-rw-r--r-- | layouts/partials/toc.html | 2 |
7 files changed, 72 insertions, 16 deletions
diff --git a/i18n/en.yaml b/i18n/en.yaml new file mode 100644 index 0000000..a37e54c --- /dev/null +++ b/i18n/en.yaml @@ -0,0 +1,28 @@ +- id: last_mod_on + translation: Last modified on {{ .Format "2006-01-02" }} +- id: format_date + translation: '{{ .Format "2006-01-02" }}' +- id: format_date_tosec + translation: '{{ .Format "2006-01-02 15:04" }}' +- id: next_link + translation: Next +- id: prev_link + translation: Previous +- id: no_newer_posts + translation: No newer posts. +- id: no_older_posts + translation: No older posts. +- id: comments_disabled + translation: Comments Disabled. +- id: livere_comments_activate_js + translation: Please activate JavaScript to use Livere Comment. +- id: hugo_theme + translation: Hugo Theme +- id: ported_from + translation: Ported from +- id: by + translation: by +- id: draft + translation: DRAFT +- id: toc_title + translation: CATALOG diff --git a/i18n/fr.yaml b/i18n/fr.yaml new file mode 100644 index 0000000..c3990a6 --- /dev/null +++ b/i18n/fr.yaml @@ -0,0 +1,28 @@ +- id: last_mod_on + translation: Dernière modification le {{ .Format "02/01/2006" }} +- id: format_date + translation: '{{ .Format "02/01/2006" }}' +- id: format_date_tosec + translation: '{{ .Format "02/01/2006 15h04" }}' +- id: next_link + translation: Suivant +- id: prev_link + translation: Précédent +- id: no_newer_posts + translation: Pas de post plus récent. +- id: no_older_posts + translation: Pas de post plus ancien. +- id: comments_disabled + translation: Commentaires Désactivés. +- id: livere_comments_activate_js + translation: Veuillez activer JavaScript pour utiliser le système de commentaires Livere. +- id: hugo_theme + translation: Theme Hugo +- id: ported_from + translation: Adapté de +- id: by + translation: par +- id: draft + translation: BROUILLON +- id: toc_title + translation: TABLE diff --git a/layouts/_default/single.html b/layouts/_default/single.html index d2c9bcd..7839dd8 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -28,7 +28,7 @@ <div class="post-meta"> {{ if .Params.date}} <time itemprop="datePublished"> - {{ .PublishDate.Format "2006-01-02 15:04" }} + {{ i18n "format_date_tosec" .PublishDate }} </time> {{ end }} @@ -66,7 +66,7 @@ {{.Content}} {{ if not .Lastmod.IsZero }} <HR width="100%" id="EOF"> - <p style="color:#777;">Last modified on {{ .Page.Lastmod.Format "2006-01-02" }}</p> + <p style="color:#777;">{{ i18n "last_mod_on" .Page.Lastmod }}</p> {{ end }} </div> </div> @@ -76,28 +76,28 @@ {{if .Next}} <a class="newer-posts" href="{{.Next.Permalink}}"> - Next<br>{{.Next.Title}} + {{ i18n "next_link" }}<br>{{.Next.Title}} </a> {{else}} <a class="newer-posts"> - Next<br>No newer posts. + {{ i18n "next_link" }}<br>{{ i18n "no_newer_posts"}} </a> {{end}} {{if .Prev}} <a class="older-posts" href="{{.Prev.Permalink}}"> - Previous<br>{{.Prev.Title}} + {{ i18n "prev_link" }}<br>{{.Prev.Title}} </a> {{else}} <a class="older-posts"> - Previous<br>No older posts. + {{ i18n "prev_link" }}<br>{{ i18n "no_older_posts" }} </a> {{end}} </nav> <div class="post-comment-wrapper"> {{ if eq .Params.comment false }} <p style="opacity: 0.6" align="center"> - <small>Comments Disabled.</small> + <small>{{ i18n "comments_disabled" }}</small> </p> {{ else }} {{- partial "comment.html" . -}} diff --git a/layouts/partials/comment.html b/layouts/partials/comment.html index 1af71d5..6f4d4fa 100644 --- a/layouts/partials/comment.html +++ b/layouts/partials/comment.html @@ -15,6 +15,6 @@ {{ if .Site.Params.livereId }} <div id="lv-container" data-id="city" data-uid={{.Site.Params.livereId}}> - <noscript>Please activate JavaScript to use Livere Comment.</noscript> + <noscript>{{ i18n "livere_comments_activate_js" }}</noscript> </div> -{{ end }}
\ No newline at end of file +{{ end }} diff --git a/layouts/partials/copyright.html b/layouts/partials/copyright.html index 07403c6..69ee264 100644 --- a/layouts/partials/copyright.html +++ b/layouts/partials/copyright.html @@ -1,7 +1,7 @@ <!-- Please don't remove the information of theme makers. --> -Hugo Theme <a href="https://github.com/amazingrise/hugo-theme-diary">Diary</a> by <a href="https://amazingrise.net">Rise</a> +{{ i18n "hugo_theme" }} <a href="https://github.com/amazingrise/hugo-theme-diary">Diary</a> {{ i18n "by" }} <a href="https://amazingrise.net">Rise</a> <br> -Ported from <a href="https://mak1t0.cc/" target="_blank" rel="noreferrer noopener">Makito</a>'s <a href="https://github.com/SumiMakito/hexo-theme-journal/" target="_blank" rel="noreferrer noopener">Journal.</a> <br> +{{ i18n "ported_from" }} <a href="https://mak1t0.cc/" target="_blank" rel="noreferrer noopener">Makito</a>'s <a href="https://github.com/SumiMakito/hexo-theme-journal/" target="_blank" rel="noreferrer noopener">Journal.</a> <br> <br> <!-- Because this project is under MIT licence. --> © @@ -9,4 +9,4 @@ Ported from <a href="https://mak1t0.cc/" target="_blank" rel="noreferrer noopene {{ .Site.Copyright }} {{ else }} {{.Site.Home.Date.Year}} {{.Site.Title}} - {{ end }}
\ No newline at end of file + {{ end }} diff --git a/layouts/partials/post-item-meta.html b/layouts/partials/post-item-meta.html index 183c9fa..c089076 100644 --- a/layouts/partials/post-item-meta.html +++ b/layouts/partials/post-item-meta.html @@ -1,5 +1,5 @@ <div class="post-item-meta"> - {{ .PublishDate.Format "2006-01-02" }} + {{ i18n "format_date" .PublishDate }}   <!-- Reading Time Start --> {{ if .Site.Params.enableReadingTime }} @@ -17,6 +17,6 @@ <!-- Reading Time End -->   {{ if .Draft }} - <span class="draft-label">DRAFT</span> + <span class="draft-label">{{ i18n "draft" }}</span> {{ end }} -</div>
\ No newline at end of file +</div> diff --git a/layouts/partials/toc.html b/layouts/partials/toc.html index 3772450..a21fa69 100644 --- a/layouts/partials/toc.html +++ b/layouts/partials/toc.html @@ -6,7 +6,7 @@ {{ $h1_n := len (findRE "(.|\n])+?" .Content) }} {{ $re := (cond (eq $h1_n 0) "<h[2-4]" "<h[1-4]") }} {{ $renum := (cond (eq $h1_n 0) "[2-4]" "[1-4]") }} - <center>- CATALOG -</center> + <center>- {{ i18n "toc_title" }} -</center> {{ range $headers }} {{ $header := . }} {{ range first 1 (findRE $re $header 1) }} |