diff options
Diffstat (limited to 'langs')
-rw-r--r-- | langs/config.go | 3 | ||||
-rw-r--r-- | langs/language.go | 7 |
2 files changed, 10 insertions, 0 deletions
diff --git a/langs/config.go b/langs/config.go index 3c7278388..15c0bedbc 100644 --- a/langs/config.go +++ b/langs/config.go @@ -24,6 +24,9 @@ type LanguageConfig struct { // The language name, e.g. "English". LanguageName string + // The language code, e.g. "en-US". + LanguageCode string + // The language title. When set, this will // override site.Title for this language. Title string diff --git a/langs/language.go b/langs/language.go index 232331cae..a1b8f4326 100644 --- a/langs/language.go +++ b/langs/language.go @@ -102,6 +102,13 @@ func (l *Language) Params() maps.Params { return l.params } +func (l *Language) LanguageCode() string { + if l.LanguageConfig.LanguageCode != "" { + return l.LanguageConfig.LanguageCode + } + return l.Lang +} + func (l *Language) loadLocation(tzStr string) error { location, err := time.LoadLocation(tzStr) if err != nil { |