aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlbert Nigmatzianov <[email protected]>2017-03-31 15:04:52 +0200
committerBjørn Erik Pedersen <[email protected]>2017-04-02 18:43:32 +0200
commitfe8462b205e0b1367953cb6816005f451a75a1e6 (patch)
tree8eb4f4ef19cf201ad0baeb780c7fca3af0ce78db
parentd122260de76e2f2e8b22a727f6f49e07383ac9f8 (diff)
downloadhugo-fe8462b205e0b1367953cb6816005f451a75a1e6.tar.gz
hugo-fe8462b205e0b1367953cb6816005f451a75a1e6.zip
docs, examples: Use TOML for i18n config files
Fix #3200
-rw-r--r--docs/content/content/multilingual.md23
-rw-r--r--examples/multilingual/i18n/en.toml2
-rw-r--r--examples/multilingual/i18n/en.yaml3
-rw-r--r--examples/multilingual/i18n/et.toml2
-rw-r--r--examples/multilingual/i18n/et.yaml2
5 files changed, 15 insertions, 17 deletions
diff --git a/docs/content/content/multilingual.md b/docs/content/content/multilingual.md
index bb0857743..6dfb1d32d 100644
--- a/docs/content/content/multilingual.md
+++ b/docs/content/content/multilingual.md
@@ -118,9 +118,9 @@ The above also uses the `i18n` func, see [Translation of strings](#translation-o
### Translation of strings
-Hugo uses [go-i18n](https://github.com/nicksnyder/go-i18n) to support string translations. Follow the link to find tools to manage your translation workflows.
+Hugo uses [go-i18n](https://github.com/nicksnyder/go-i18n) to support string translations. Follow the link to find tools to manage your translation workflows.
-Translations are collected from the `themes/[name]/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to RFC 5646 with names such as `en-US.yaml`, `fr.yaml`, etc.
+Translations are collected from the `themes/[name]/i18n/` folder (built into the theme), as well as translations present in `i18n/` at the root of your project. In the `i18n`, the translations will be merged and take precedence over what is in the theme folder. Language files should be named according to RFC 5646 with names such as `en-US.toml`, `fr.toml`, etc.
From within your templates, use the `i18n` function like this:
@@ -128,11 +128,11 @@ From within your templates, use the `i18n` function like this:
{{ i18n "home" }}
```
-This uses a definition like this one in `i18n/en-US.yaml`:
+This uses a definition like this one in `i18n/en-US.toml`:
```
-- id: home
- translation: "Home"
+[home]
+other = "Home"
```
Often you will want to use to the page variables in the translations strings. To do that, pass on the "." context when calling `i18n`:
@@ -141,19 +141,18 @@ Often you will want to use to the page variables in the translations strings. To
{{ i18n "wordCount" . }}
```
-This uses a definition like this one in `i18n/en-US.yaml`:
+This uses a definition like this one in `i18n/en-US.toml`:
```
-- id: wordCount
- translation: "This article has {{ .WordCount }} words."
+[wordCount]
+other = "This article has {{ .WordCount }} words."
```
An example of singular and plural form:
```
-- id: readingTime
- translation:
- one: "One minute read"
- other: "{{.Count}} minutes read"
+[readingTime]
+one = "One minute read"
+other = "{{.Count}} minutes read"
```
And then in the template:
diff --git a/examples/multilingual/i18n/en.toml b/examples/multilingual/i18n/en.toml
new file mode 100644
index 000000000..30893b411
--- /dev/null
+++ b/examples/multilingual/i18n/en.toml
@@ -0,0 +1,2 @@
+[head_title]
+other = "Multilingual"
diff --git a/examples/multilingual/i18n/en.yaml b/examples/multilingual/i18n/en.yaml
deleted file mode 100644
index 55528cfee..000000000
--- a/examples/multilingual/i18n/en.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-- id: head_title
- translation: "Multilingual"
-
diff --git a/examples/multilingual/i18n/et.toml b/examples/multilingual/i18n/et.toml
new file mode 100644
index 000000000..a96203eff
--- /dev/null
+++ b/examples/multilingual/i18n/et.toml
@@ -0,0 +1,2 @@
+[head_title]
+other = "Mitmekeelne"
diff --git a/examples/multilingual/i18n/et.yaml b/examples/multilingual/i18n/et.yaml
deleted file mode 100644
index 3402619cd..000000000
--- a/examples/multilingual/i18n/et.yaml
+++ /dev/null
@@ -1,2 +0,0 @@
-- id: head_title
- translation: "Mitmekeelne"