mirror of
https://github.com/gohugoio/hugo.git
synced 2024-11-29 08:32:05 -05:00
1.6 KiB
1.6 KiB
title | description | categories | keywords | action | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Language | Returns the language object for the given page. |
|
The Language
method on a Page
object returns the language object for the given page. The language object points to the language definition in the site configuration.
You can also use the Language
method on a Site
object. See details.
Methods
The examples below assume the following in your site configuration:
{{< code-toggle file=hugo >}} [languages.de] languageCode = 'de-DE' languageDirection = 'ltr' languageName = 'Deutsch' weight = 2 {{< /code-toggle >}}
- Lang
- (
string
) The language tag as defined by RFC 5646.
{{ .Language.Lang }} → de
- LanguageCode
- (
string
) The language code from the site configuration. Falls back toLang
if not defined.
{{ .Language.LanguageCode }} → de-DE
- LanguageDirection
- (
string
) The language direction from the site configuration, eitherltr
orrtl
.
{{ .Language.LanguageDirection }} → ltr
- LanguageName
- (
string
) The language name from the site configuration.
{{ .Language.LanguageName }} → Deutsch
- Weight
- (
int
) The language weight from the site configuration which determines its order in the slice of languages returned by theLanguages
method on aSite
object.
{{ .Language.Weight }} → 2