Setting for enabling missing placeholders does not work as expected

I set enableMissingTranslationPlaceholders to true in config.
There is a dozen of languages (content dir per language). Two of the languages are translated in i18n files. Other languages are not.

What I expect to see is some placeholders in places with missing translations. Instead, I see only English (default language) in all other pages (Portuguese, German, etc.). If I add translation, I see the translation correctly.

Is there something else I need to do with enableMissingTranslationPlaceholders setting? Is my understanding of the setting incorrect?

Hugo Static Site Generator v0.48/extended darwin/amd64 BuildDate: unknown
GOOS=“darwin”
GOARCH=“amd64”
GOVERSION=“go1.11”

Can you show your config file; maybe link your repo?

@RickCogley Would this screenshot suffice?

Thank you for help!

Maybe you need an actual languages section in your config.

I have those language sections (they contain links to Static folders and Menu). Or do you suggest to add enableMissingTranslationPlaceholders settings inside those language sections?

no, your config looks right. Are you running hugo server with the verbose option to see if there are any warnings?

You can also run hugo server with --i18n-warnings to see if it returns anything.

I’m grasping at straws but, in the past I’ve observed:

  • the order of things in the config file makes a difference but I can’t be more precise about that
  • gaps in the config file (blank lines and comments) may make a difference

This could just be voodoo magic thinking on my part.

1 Like

Thank you @RickCogley! I think you helped me out here.

–i18n-warnings is useful. It showed zero warnings. Before it helped me to see the wrong id I used for the translation. It was missing in i18n files. After that it showed 0 warnings.

I18N folder contained only two complete translations (en.yaml and fr.yaml). Then I added one empty language file (Portuguese, pt.yaml). I guessed the setting to show placeholders may work only if the actual file is there. But it still showed 0 warnings. Maybe it was some cache issue or something else, even though I carefully try using empty cache browser and restart the server regularly.

Now it shows place holders for Portuguese, and it also prints warnings for Portuguese as well. The issue was to have pt.yaml file (and for other languages in I18N folder). The issue is resolved.

Yeah, that requirement to have i18n files even if they just have one entry is a known quirk, but I’d forgotten. Glad to have been of some help.

1 Like