diff options
author | tosi29 <tosi16@gmail.com> | 2019-04-08 16:30:57 +0300 |
---|---|---|
committer | tosi29 <tosi16@gmail.com> | 2019-04-08 16:30:57 +0300 |
commit | 34db3dee784b5bfe9d23150ed9ac4de8161283d7 (patch) | |
tree | 430386cedf11087c525bf5136fd8ebee97abfa20 | |
parent | c875dccc57d5b0dd768b6e09d271b6ea0a50a141 (diff) |
Support i18n (en-us, ja)
-rw-r--r-- | exampleSite/config.toml | 2 | ||||
-rw-r--r-- | i18n/en-us.yaml | 16 | ||||
-rw-r--r-- | i18n/ja.yaml | 16 | ||||
-rw-r--r-- | layouts/partials/relatedposts.html | 2 | ||||
-rw-r--r-- | layouts/partials/sidebar.html | 8 |
5 files changed, 38 insertions, 6 deletions
diff --git a/exampleSite/config.toml b/exampleSite/config.toml index 7ca16e3..c4df146 100644 --- a/exampleSite/config.toml +++ b/exampleSite/config.toml @@ -4,7 +4,7 @@ author = "Author" paginate = 10 languageCode = "en-us" -DefaultContentLanguage = "en" +DefaultContentLanguage = "en-us" hasCJKLanguage = "true" enableInlineShortcodes = true diff --git a/i18n/en-us.yaml b/i18n/en-us.yaml new file mode 100644 index 0000000..9a66224 --- /dev/null +++ b/i18n/en-us.yaml @@ -0,0 +1,16 @@ + + +- id: related_posts_title + translation: Related Posts + +- id: categories_title + translation: Categories + +- id: tags_title + translation: Tags + +- id: recent_posts_title + translation: Recent Posts + +- id: archives_title + translation: Archives diff --git a/i18n/ja.yaml b/i18n/ja.yaml new file mode 100644 index 0000000..9a1f0d0 --- /dev/null +++ b/i18n/ja.yaml @@ -0,0 +1,16 @@ + + +- id: related_posts_title + translation: 関連記事 + +- id: categories_title + translation: カテゴリ + +- id: tags_title + translation: タグ + +- id: recent_posts_title + translation: 最近の投稿 + +- id: archives_title + translation: アーカイブ diff --git a/layouts/partials/relatedposts.html b/layouts/partials/relatedposts.html index ba0f23b..6abb6d4 100644 --- a/layouts/partials/relatedposts.html +++ b/layouts/partials/relatedposts.html @@ -1,6 +1,6 @@ {{ $related := .Site.RegularPages.Related . | first 7 }} {{ with $related }} -<h4>Related Posts</h4> +<h4>{{ T "related_posts_title" }}</h4> <ol style="margin-left: 30px; list-style-type: decimal;"> {{ range . }} <li><strong><a href="{{ .RelPermalink }}">{{ .Title }}</a></strong></li> diff --git a/layouts/partials/sidebar.html b/layouts/partials/sidebar.html index f34f4e7..c46df7b 100644 --- a/layouts/partials/sidebar.html +++ b/layouts/partials/sidebar.html @@ -1,7 +1,7 @@ <div class="sidebar1 widgets columns-1"> <aside class="widget widget_categories"> - <h2>Categories</h2> + <h2>{{ T "categories_title" }}</h2> <ul class="widget__list"> {{- range $name, $items := .Site.Taxonomies.categories -}} <li class="cat-item cat-item-2"> @@ -12,7 +12,7 @@ </aside> <aside class="widget widget_tag_cloud"> - <h2>Tags</h2> + <h2>{{ T "tags_title" }}</h2> <div class="tagcloud"> {{- range $name, $items := .Site.Taxonomies.tags -}} <a class="tag-cloud-link" href="{{- "tags/" | relLangURL -}}{{- $name | urlize | lower -}}" title="{{ $name }}" style="font-size: 12pt;">{{ $name }} </a> @@ -21,7 +21,7 @@ </aside> <aside class="widget widget_recent_entries"> - <h2>Recent Posts</h2> + <h2>{{ T "recent_posts_title" }}</h2> <ul> {{- $recent_articles_num := (.Site.Params.widgets.recent_articles_num | default 10) }} {{- range first $recent_articles_num (where .Site.RegularPages "Section" "in" (.Site.Params.postSections | default (slice "post"))) }} @@ -33,7 +33,7 @@ </aside> <aside class="widget widget_archive"> - <h2>Archives</h2> + <h2>{{ T "archives_title" }}</h2> <ul> {{- range $name, $items := .Site.Taxonomies.archives -}} <li><a href="{{- "archives/" | relLangURL -}}{{- $name | urlize | lower -}}">{{ $name | title }}</a> ({{ $items.Count }})</li> |