Replace languageCode with locale.

This commit is contained in:
Fredrik Jonsson 2026-05-02 21:28:07 +02:00
commit 4fcfc39fc8
2 changed files with 14 additions and 14 deletions

View file

@ -277,7 +277,7 @@ Configurations parameters for the sites config file, in yaml format. All the "pa
baseurl: "https://example.org/" baseurl: "https://example.org/"
title: "SiteTitle" title: "SiteTitle"
theme: "zen" theme: "zen"
languageCode: "en-GB" # Set your language code (only needed for none multilingual sites). locale: "en-GB" # Set your language code (only needed for none multilingual sites).
params: params:
alpine: true # Add AlpineJS, default false. alpine: true # Add AlpineJS, default false.
@ -460,29 +460,29 @@ Example render hook to "Copy code" buttons to codeblocks". To activate it copy t
## Multilingual ## Multilingual
A language selector will be included on sites with more than one language. Add `languageName` to your language configuration, this is what will be displayed in the selector. A language selector will be included on sites with more than one language. Add `label` to your language configuration, this is what will be displayed in the selector.
The language selector will link to a translation of the current page if it exist and to the front page if it does not. The language selector will link to a translation of the current page if it exist and to the front page if it does not.
For "rtl" languages add a `languageDirection` parameter to the language configuration. If not added it will default to "ltr". For "rtl" languages add a `direction` parameter to the language configuration. If not added it will default to "ltr".
Add a `languageCode` parameter to each language as well, that is used to set the correct language attribute in the `html` tag and in feeds. The root `languageCode` is then not needed. If not set the language key (e.g. "en") will be used. Add a `locale` parameter to each language as well, that is used to set the correct language attribute in the `html` tag and in feeds. The root `locale` is then not needed. If not set the language key (e.g. "en") will be used.
```yaml ```yaml
languages: languages:
sv: sv:
weight: 1 weight: 1
languageName: "Svenska" label: "Svenska"
languageCode: "sv-SE" locale: "sv-SE"
en: en:
weight: 2 weight: 2
languageName: "English" label: "English"
languageCode: "en-GB" locale: "en-GB"
ar: ar:
weight: 3 weight: 3
languageName: "العربية" label: "العربية"
languageDirection: "rtl" direction: "rtl"
languageCode: "ar" locale: "ar"
``` ```
The Zen theme templates has some strings that needs translation, e.g. "Home" and "Menu". Many translations are included and you can easily add more to the `i18n` site directory. All but English and Swedish are contributed by users, thanks! The Zen theme templates has some strings that needs translation, e.g. "Home" and "Menu". Many translations are included and you can easily add more to the `i18n` site directory. All but English and Swedish are contributed by users, thanks!
@ -506,12 +506,12 @@ The Zen theme templates has some strings that needs translation, e.g. "Home" and
If you want to have a site in another language than English but do not need multiple languages the following settings are needed. If you want to have a site in another language than English but do not need multiple languages the following settings are needed.
Set `defaultContentLanguage` to your language code, otherwise it will default to "en" . Also set `languageCode` so browsers are informed of what language the site is in. Set `defaultContentLanguage` to your language code, otherwise it will default to "en" . Also set `locale` so browsers are informed of what language the site is in.
Here how it looks for a site in Swedish. Here how it looks for a site in Swedish.
```yaml ```yaml
languageCode: "sv-SE" locale: "sv-SE"
defaultContentLanguage: "sv" defaultContentLanguage: "sv"
``` ```

View file

@ -2,7 +2,7 @@
title: "Hugo Zen theme" title: "Hugo Zen theme"
baseURL: "https://example.org/" baseURL: "https://example.org/"
theme: "zen" theme: "zen"
languageCode: "en-GB" locale: "en-GB"
defaultContentLanguage: "en" defaultContentLanguage: "en"
pluralizelisttitles: false pluralizelisttitles: false
removePathAccents: true removePathAccents: true