mirror of
https://github.com/gohugoio/hugo.git
synced 2024-07-05 08:42:12 +00:00
docs: Add singular/plural i18n example
This commit is contained in:
parent
e6f2426ef0
commit
faa64abdc2
|
@ -139,7 +139,19 @@ This uses a definition like this one in `i18n/en-US.yaml`:
|
||||||
- id: wordCount
|
- id: wordCount
|
||||||
translation: "This article has {{ .WordCount }} words."
|
translation: "This article has {{ .WordCount }} words."
|
||||||
```
|
```
|
||||||
|
An example of singular and plural form:
|
||||||
|
|
||||||
|
```
|
||||||
|
- id: readingTime
|
||||||
|
translation:
|
||||||
|
one: "One minute read"
|
||||||
|
other: "{{.Count}} minutes read"
|
||||||
|
```
|
||||||
|
And then in the template:
|
||||||
|
|
||||||
|
```
|
||||||
|
{{ i18n "readingTime" .ReadingTime }}
|
||||||
|
```
|
||||||
To track down missing translation strings, run Hugo with the `--i18n-warnings` flag:
|
To track down missing translation strings, run Hugo with the `--i18n-warnings` flag:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
Loading…
Reference in a new issue