Hello,
I’m using a multilingual theme, where I am running hugo with i18n in EN and FR.
my posts shares same categories like “photography” for both English and French posts.
my question is, how can I translate my categories in i18n? I already defined some of my categories in both en.yaml and fr.yaml, but I don’t know how to display them.
I already used {{ i18n ".Params.Categories" }}
, it’s not working.
It depends on the structure of the i18n
files. Here’s a working example:
git clone --single-branch -b hugo-forum-topic-34455 https://github.com/jmooring/hugo-testing hugo-forum-topic-34455
cd hugo-forum-topic-34455
hugo server
Then visit:
http://localhost:1313/es/posts/post-1/
http://localhost:1313/es/colors/
http://localhost:1313/es/colors/red/
Pros:
- You can use the same taxonomies and terms across all languages
Cons:
- Templates become a little more complex, and a little more fragile
- Taxonomy and term URLs are not localized
This approach would be more valuable if a page could inherit missing params from the default content language (similar to cascade
, but for siblings instead of descendants). For example, assign tags and categories in content/posts/post-1.en.md, and the other translations would use the same values unless overridden. This has come up before:
1 Like