You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/functions/lang/Translate.md
+14-15Lines changed: 14 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,27 +13,27 @@ aliases: [/functions/i18n]
13
13
14
14
The `lang.Translate` function returns the value associated with given key as defined in the translation table for the current language.
15
15
16
-
If the key is not found in the translation table for the current language, the `lang.Translate` function falls back to the translation table for the [`defaultContentLanguage`].
16
+
If the key is not found in the translation table for the current language, the `lang.Translate` function falls back to the translation table for the [`defaultContentLanguage`][].
17
17
18
18
If the key is not found in the translation table for the `defaultContentLanguage`, the `lang.Translate` function returns an empty string.
19
19
20
20
> [!note]
21
21
> To list missing and fallback translations, use the `--printI18nWarnings` flag when building your site.
22
22
>
23
-
> To render placeholders for missing and fallback translations, set [`enableMissingTranslationPlaceholders`] to `true` in your site configuration.
23
+
> To render placeholders for missing and fallback translations, set [`enableMissingTranslationPlaceholders`][] to `true` in your site configuration.
24
24
25
25
## Translation tables
26
26
27
-
Create translation tables in the `i18n` directory, naming each file according to [RFC 5646]. Translation tables may be JSON, TOML, or YAML. For example:
27
+
Create translation tables in the `i18n` directory, naming each file according to [RFC 5646][]. Translation tables may be JSON, TOML, or YAML. For example:
28
28
29
29
```text
30
30
i18n/en.toml
31
31
i18n/en-US.toml
32
32
```
33
33
34
-
The base name must match the [language key] as defined in your site configuration.
34
+
The base name must match the [language key][] as defined in your site configuration.
35
35
36
-
Artificial languages with private use subtags as defined in [RFC 5646 § 2.2.7] are also supported. You may omit the `art-x-` prefix for brevity. For example:
36
+
Artificial languages with private use subtags as defined in [RFC 5646 § 2.2.7][] are also supported. You may omit the `art-x-` prefix for brevity. For example:
37
37
38
38
```text
39
39
i18n/art-x-hugolang.toml
@@ -94,7 +94,7 @@ i18n/
94
94
└── pl.toml
95
95
```
96
96
97
-
The Unicode [CLDR Plural Rules chart] describes the pluralization categories for each language.
97
+
The Unicode [CLDR Plural Rules chart][CLDR] describes the pluralization categories for each language.
98
98
99
99
The English translation table:
100
100
@@ -177,7 +177,7 @@ Template code:
177
177
178
178
## Reserved keys
179
179
180
-
Hugo uses the [go-i18n] package to look up values in translation tables. This package reserves the following keys for internal use:
180
+
Hugo uses the [go-i18n][] package to look up values in translation tables. This package reserves the following keys for internal use:
181
181
182
182
id
183
183
: (`string`) Uniquely identifies the message.
@@ -195,22 +195,22 @@ rightdelim
195
195
: (`string`) The right Go template delimiter.
196
196
197
197
zero
198
-
: (`string`) The content of the message for the [CLDR] plural form "zero".
198
+
: (`string`) The content of the message for the [CLDR][] plural form "zero".
199
199
200
200
one
201
-
: (`string`) The content of the message for the [CLDR] plural form "one".
201
+
: (`string`) The content of the message for the [CLDR][] plural form "one".
202
202
203
203
two
204
-
: (`string`) The content of the message for the [CLDR] plural form "two".
204
+
: (`string`) The content of the message for the [CLDR][] plural form "two".
205
205
206
206
few
207
-
: (`string`) The content of the message for the [CLDR] plural form "few".
207
+
: (`string`) The content of the message for the [CLDR][] plural form "few".
208
208
209
209
many
210
-
: (`string`) The content of the message for the [CLDR] plural form "many".
210
+
: (`string`) The content of the message for the [CLDR][] plural form "many".
211
211
212
212
other
213
-
: (`string`) The content of the message for the [CLDR] plural form "other".
213
+
: (`string`) The content of the message for the [CLDR][] plural form "other".
214
214
215
215
If you need to provide a translation for one of the reserved keys, you can prepend the word with an underscore. For example:
0 commit comments