I18n and markdown

I have created a page company.md. This page should be translated with i18n. I use a de.json with the following structure.

	"Mehr lesen": "Mehr lesen",
	"404 Nicht gefunden": "404 Nicht gefunden",
	"Leider konnte die Seite, die Sie aufgerufen haben, nicht gefunden werden.": "Leider konnte die Seite, die Sie aufgerufen haben, nicht gefunden werden.",
	"Start": "Start",
	"Unternehmen": "Unternehmen",
	"Impressum": "Impressum",
	"Rechtliche Hinweise": "Rechtliche Hinweise",
	"Sicherheit": "Sicherheit",
	"Kontakt": "Kontakt"


title: {{ i18n "Unternehmen" }}        -- would be an idea, but it doesn't work
date: 2023-08-03T14:01:33Z
draft: false
menu: main
weight: 20
subtitle: {{ i18n "Lerne die wesentlichen Konzepte von Hugo" }}

# {{ i18n "Unternehmen" }}

How do I have to change the header and the body in the company.md file?

With the exception of archetypes, you cannot use template code in front matter.

1 Like

If I have understood you correctly, do I need a separate file for each language? in German language unternehmen.md and in English language company.md? I thought it is possible to have a single *.md file and have i18n insert you correct translation.

Translations (i.e., with the i18n function) are performed within templates, not within content.

If you want translated content, you have to… translate the content.

Here’s an example multilingual site:

git clone --single-branch -b hugo-forum-topic-44549 https://github.com/jmooring/hugo-testing hugo-forum-topic-44549
cd hugo-forum-topic-44549
hugo server
1 Like

Please forgive my late feedback.

The link GitHub - jmooring/hugo-testing: Hugo test sites related to Forum topics or GitHub issues hugo-forum-topic-44549 was very helpful.

The idea was to push the translated text direct into the markdown file. So I have to translate and write the content in the markdown file. I would have appreciated a solution from which I can write the markdown files from a *.json or *.svg file.

Thank you very much for the help.