Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/EmielH/tale-hugo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmiel Hollander <EmielH@users.noreply.github.com>2018-09-30 12:39:38 +0300
committerEmiel Hollander <EmielH@users.noreply.github.com>2018-09-30 12:39:38 +0300
commit7ffbe45d665c34048803bb21b8e3002c8b605e94 (patch)
treeb5e367ce638519c63e3221d46c06b04c0f31f63b
parentc306070aeed76cb98d9cc2eb36fd469b624af6eb (diff)
Add i18n capabilities
-rw-r--r--README.md18
-rw-r--r--i18n/en.toml14
-rw-r--r--i18n/nl.toml14
-rw-r--r--layouts/_default/single.html4
-rw-r--r--layouts/partials/footer.html2
-rw-r--r--layouts/partials/header.html4
6 files changed, 50 insertions, 6 deletions
diff --git a/README.md b/README.md
index 76f4c1e..069e9b4 100644
--- a/README.md
+++ b/README.md
@@ -36,7 +36,7 @@ hugo server -t tale
### Additional information
-For more information, read the official [setup guide]( https://gohugo.io/overview/installing/) of Hugo.
+For more information, read the official [setup guide](https//gohugo.io/overview/installing/) of Hugo.
### Update the theme
@@ -48,6 +48,22 @@ git submodule update --remote --rebase
If you have cloned the theme, you can run `git pull` inside the theme folder.
+## Configuration
+
+### Internationalisation (i18n)
+
+Tale supports using other languages than English. Language files for the texts Tale uses are provided in the `i18n` directory. The default language is English. To swith languages, add the key `defaultContentLanguage` to your `config.toml` file. For example:
+
+```
+defaultContentLanguage = "nl"
+```
+
+To translate texts your site uses, add an `i18n` folder to your site.
+
+Feel free to submit pull requests for other translations of Tale's texts.
+
+[Hugo documentation for multilingual sites](//gohugo.io/content-management/multilingual/)
+
## Acknowledgments
Thanks
diff --git a/i18n/en.toml b/i18n/en.toml
new file mode 100644
index 0000000..d3a0bb7
--- /dev/null
+++ b/i18n/en.toml
@@ -0,0 +1,14 @@
+[posts]
+other = "Posts"
+
+[about]
+other = "About"
+
+[writtenBy]
+other = "Written by"
+
+[on]
+other = "on"
+
+[generator]
+other = "Made with <a href='https://gohugo.io'>Hugo</a> using the <a href='https://github.com/EmielH/tale-hugo/'>Tale</a> theme." \ No newline at end of file
diff --git a/i18n/nl.toml b/i18n/nl.toml
new file mode 100644
index 0000000..9c5c8f7
--- /dev/null
+++ b/i18n/nl.toml
@@ -0,0 +1,14 @@
+[posts]
+other = "Artikelen"
+
+[about]
+other = "Over"
+
+[writtenBy]
+other = "Geschreven door"
+
+[on]
+other = "op"
+
+[generator]
+other = "Gemaakt met <a href='https://gohugo.io'>Hugo</a> en thema <a href='https://github.com/EmielH/tale-hugo/'>Tale</a>." \ No newline at end of file
diff --git a/layouts/_default/single.html b/layouts/_default/single.html
index 2e05fc5..6e46c07 100644
--- a/layouts/_default/single.html
+++ b/layouts/_default/single.html
@@ -3,7 +3,7 @@
<main>
<div class="post">
<div class="post-info">
- <span>Written by</span>
+ <span>{{ i18n "writtenBy" }}</span>
{{- if .Params.Author }}
{{ .Params.Author }}
{{- else }}
@@ -12,7 +12,7 @@
{{- if .PublishDate }}
<br>
- <span>on&nbsp;</span><time datetime="{{ .PublishDate }}">{{ .PublishDate.Format "January 2, 2006" }}</time>
+ <span>{{ i18n "on" }}&nbsp;</span><time datetime="{{ .PublishDate }}">{{ .PublishDate.Format "January 2, 2006" }}</time>
{{- end }}
</div>
diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html
index 0d57b9f..45f10de 100644
--- a/layouts/partials/footer.html
+++ b/layouts/partials/footer.html
@@ -1,6 +1,6 @@
<footer>
<span>
- &copy; <time datetime="{{ now }}">{{ now.Format "2006" }}</time> {{ .Site.Params.Author }}. Made with Hugo using the <a href="https://github.com/EmielH/tale-hugo/">Tale</a> theme.
+ &copy; <time datetime="{{ now }}">{{ now.Format "2006" }}</time> {{ .Site.Params.Author }}. {{ i18n "generator" | safeHTML }}
</span>
</footer>
</body>
diff --git a/layouts/partials/header.html b/layouts/partials/header.html
index 21e7320..6f00f62 100644
--- a/layouts/partials/header.html
+++ b/layouts/partials/header.html
@@ -10,8 +10,8 @@
<h2 class="nav-title">{{ .Site.Title }}</h2>
</a>
<ul>
- <li><a href="{{ .Site.BaseURL }}about">About</a></li>
- <li><a href="{{ .Site.BaseURL }}">Posts</a></li>
+ <li><a href="{{ .Site.BaseURL }}about">{{ i18n "about" }}</a></li>
+ <li><a href="{{ .Site.BaseURL }}">{{ i18n "posts" }}</a></li>
</ul>
</div>
</nav> \ No newline at end of file