| 1 |
--- |
| 2 |
_comment: Do not remove front matter. |
| 3 |
--- |
| 4 |
|
| 5 |
`locale` |
| 6 |
: (`string`) The language tag as described in [RFC 5646][]. This is the primary value used by the [`language.Translate`][] function to select a translation table, and for localization of dates, currencies, numbers, and percentages, falling back to the [language key][] in both cases. |
| 7 |
|
| 8 |
Hugo also uses this value to populate: |
| 9 |
|
| 10 |
- The `lang` attribute of the `html` element in the [embedded alias template][] |
| 11 |
- The `language` element in the [embedded RSS template][] |
| 12 |
- The `locale` property in the [embedded Open Graph template][] |
| 13 |
|
| 14 |
Access this value from a template using the [`Language.Locale`][] method on a `Site` or `Page` object. |
| 15 |
|
| 16 |
[RFC 5646]: https://datatracker.ietf.org/doc/html/rfc5646#section-2.1 |
| 17 |
[`Language.Locale`]: /methods/site/language/#locale |
| 18 |
[`language.Translate`]: /functions/lang/translate/ |
| 19 |
[embedded Open Graph template]: <{{% eturl opengraph %}}> |
| 20 |
[embedded RSS template]: <{{% eturl rss %}}> |
| 21 |
[embedded alias template]: <{{% eturl alias %}}> |
| 22 |
[language key]: /configuration/languages/#language-keys |