‘categories’ may in french resolve to catégories, or sujets.
But with the above code (using range $taxo) I will get the error message the hugo cannot range over .Site.Taxonomies.categories (even if it points to english). I’m really actually wanting to use:
And I don’t even know yet if there is some problem with accents. Some googling suggests to me thats possible. Not finding too much information on multilingual taxonomies. Any help appreciated.
No that doesn’t seem to work either. As I see things the range site.Taxonomies.categories must refer to what is defined in config.yaml for exemple the default category: categories. So if in another language you have sujet: sujets then the range must be site.Taxonomies.sujets (for that language). So I suppose that internally hugo doesn’t know that sujets in one language = categories in another. Maybe this can’t be done? Although since Hugo can spit out publc/en/categories and public/fr/sujets then you could get a menu going that could present that.
As far as I understand, you have created another taxonomy called “sujet”. There is no simple way to link its terms to the categories terms to my knowledge.
What I do in my multilingual site is use the same taxonomy (tags, categories) and translate it with the i18n functions. Every part of your theme that displays the taxonomies should be using the i18n function. The URL slugs for tags will not match the translated text, but that’s too little to worry about.
To give you one example, I would assign the following tags to a post in the frontmatter:
tags:
- tag-architecture
- tag-artifact
The tag- prefix is optional, but it’s best to keep the keywords to be translated unique.
Then I maintain the translations in the corresponding /i18n/en.yaml file:
Thank you!. But yes if you look at my example this is exactly what I have done with $categories := 18n “categories”. However if I then try to concaenate that variable to the range: {{ $taxo := print “.Site.Taxonomies.” $categories }} it will give me an error messag that hugo cannot range over .Site.Taxonomies.whatever-the-i18n-value-was.
Actually i’m just re-reading your comment, and I see there is a difference here. I want the url to be translated. And I will also translate the categores or tags in each post. My hacky link:
works just fine… as long as the range is .Site.Taxonomies.categories or .Site.Taxonomies.fɛɛndɔ or whatever the language category is. So you see I have tried to range over
{{ print ".Site.Taxonomies." $categories. }} And this is what is not working̀
ok this is solved. I finally got it! I can now change the langage of my blog and then the categories menu will display the categories of the current language.