Single HTML content file for multiple languages

I understand that multilingual pages can be served by creating files like this:


But I have a situation where the whole html structure is exactly the same for all languages except for the strings and text. I want to create one single html file and make it be the skeleton for all served languages.

I understand that this can be achieved by i18n string translations but what I see problematic with this approach is that all string translations must be written in what can become huge files inside:

i18n/en.yaml or themes/theme-name/i18n/en.yaml

I would prefer creating i18n files per content page and not per site as whole.

How to do that? Thank you.

I hope the question above is clear.

It is just yesterday I heard about Hugo for the first time and I like the simplicity of the framework but for my projects, content translation is important.

I suspect what you are looking for is layout files (which can also be language specific, but they do not have to be).

1 Like

What I mean is:


Which includes i18n string replacements e.g. <h2>{{ $t.our_sevices) }</h2>

And the i18n files should be under e.g. /i18n/posts/first-post

the /posts/first-post.template.html should be rendered differently depends on language prefix in URL e.g. /en or /ar.

I think such functionality should be implemented.

In short, the i18n files should be content page based and not necessarily site-wide.

I don’t understand what you want, but I suspect what you want is possible if you wrap your mind around it.