Multilingual site routing without the creation of duplicate content files

Hi there,

I am building a website with Hugo with the use of .hmtl files instead of .md for content nodes. That’s because the site itself is not a blog, or other standard types of website, but rather a SAAS type web application. So far it works great for that purpose, I put my master templates and partial views in the /layouts folder, and page-specific HTML code in the /content folder.

An example of my content structure would look like this:

content/
├── section1/
│ └── _index.html
├── section2/
│ └──_index.html
└── _index.html

Now I would like to make this web app internationalized, but I don’t want to create a separate .md/.html file for each language, as it would result in my HTML code’s duplication.

My question is - is there a way of having the content as I had before (single language like), but inside of the content page detect the current language and pull the translated strings into my HTML from i18n? How would I handle the routing then?

Or should I move all HTML out of the /content to /layouts (as a sort of an extra layer of the master template), and create empty .md/.html files with just the front matter parameters for each language as described in the documentation?

Yeah, that one.

Too sad there is no option for having a single entry point for the internationalized page. This would really help in reducing code duplication and manual work. Also the website management would be much easier if Hugo could create those static templates based on the language list in our configuration, and not from the content nodes.

Let’s say I have a website that consists of 20 HTML pages and I want to translate into 20 different languages. This would require a lot of work to create 400 content nodes manually and maintain them afterwards.

Thanks for your answer anyway.

While going through all the topics on this community forum once again, I found that module mounts might help me solve the problem that I described in the first post of this topic. Or is it not a viable solution to my issue?

I am referring to this topic: https://discourse.gohugo.io/t/do-all-page-bundles-need-localized-copies-once-you-add-a-new-language/37225/2