Question about i18n fallback translations

Hi, I’m confused by the i18n fallback translations.

Takes @jmooring code as an example.

$ git clone --single-branch -b hugo-forum-topic-44025 https://github.com/jmooring/hugo-testing hugo-forum-topic-44025

$ cd hugo-forum-topic-44025

$ hugo server

It works fine that the home.beacon will fallback to gday (en-au) on es site.
But after deleting the translations from i18n/en-au.toml, both of en-au and es sites won’t fallback to translation of i18n/en.toml (got empty string instead), is it expected?

is it expected?

Yes. From the example you referenced:

defaultContentLanguage = 'en-au'
defaultContentLanguageInSubdir = true

[languages.en-au]
languageCode = "en-au"
languageName = "Australia"
contentDir = "content/en-au"
weight = 1

[languages.es]
languageCode = "es"
languageName = "Spain"
contentDir = "content/es"
weight = 2

The fallback language is the defaultContentLanguage (en-au) not en.

In that example, the i18n/en.toml is present to demonstrate this bug, which was fixed with v0.112.0.

1 Like

Thanks for your detailed explainations.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.