Is it possible i18n scheme in Hugo?

When I make a translatable post I want to keep only one “base” article file with content like this:


This is a common text for all languages.

But could we make a <shotrcode> which would be visible only on some specified locales?

{{% only_for en %}}

For example this part will be shown on English version of this post...

{{% /only_for %}}

{{% only_for fr %}}

...and this part on French one.

{{% /only_for %}}

I guess yes, by comparing {{ .Get 0 }} to the detected language. But frontmatter is a problem.

No, this is not possible.

Ah, I think I see, because the page itself is linked to a language?

Well, thinking about this, I’m not sure that it isn’t possible … I don’t remember. You should test it.

@RickCogley @bep

Thanks for your feedback.

I asked about possibility of this because I have posts which contain many photos and much less text information.

For now I have to copy whole post content to translated page and replace a text part to translated one.

And then if I need to add or replace some images I have to do that on both pages - original and translated (Annoying copy/paste part of my process :sweat: )

It’s not a big problem, but I would be glad if there was more DRY approach to it.