I would like to make my homepage multilingual. In the folder content, I have two more folders / de and / en created. In these folders I have filed the corresponding pages. In the front office I made the following entries. Which entries do I still have to make?
I have read the documentation. Unfortunately, I could not implement my idea. I ask for help again. I have in the directory content two more directories / de and / en. In these directories are the contents for each language. I want the browser to recognize that if the language is not German, it should switch to the English language. On the homepage itself, however, a switch for switching the language in the footer should be installed. I have inserted the following in front of each page. My questions are:
What do I have to enter in /content/_index.md?
Which entries do I have to enter in the config.toml?
How do I implement the switch to toggle in the footer of the page?
I began managing translations by filename, then switched by folder (and renamed all my content files). I prefer this way since it keeps the file hierarchy tidy. See my content folder here:
At first I’d like to create just for some chosen content in /posts/ in another language. What would happen if there are no translated posts? Will the original file be shown?
Is there a possibility to choose the browser the proper language. For longterm I would create a language switcher as you have done on your site.
What is also unclear to me, whether links to other post have to be modified.
No, in my setup, when no translation exists, the language switcher do simply not display the missing language link.
I don’t know if I understand you correctly, but in my setup, the links to translated posts are automatic, provided the content file name is the same in all languages.
This has nothing to do with Hugo, but with your hosting server/service. It should detect the browser default language, and automatically serve the correct URL.
Can you help me please with my config.toml
I don’t know how to set the language code “de”
[languages]
de:
languageName = German
weight = 1
en:
languageName = English
weight = 2