HUGO

Problem having multilingual taxonomy terms

I would like to have multilingual taxonomies: “tags” in English, and its equivalent in Spanish: “etiquetas”, so each site has their own urls with their proper language. In config.toml I define:

  [languages.en.taxonomies]
    tag = "tags"
  [languages.es.taxonomies]
    tag = "etiquetas"

This way I can use them in front matter like: in English: tags: .., in Spanish: etiquetas: .... and then the urls are like that too /tags/.., /es/etiquetas/.
The problem is when I create a partial or shortcode that makes use of that taxonomy, I can’t access the Page singular form (“tag”) but can only access the plural form (“tags” or “etiquetas”).

Is there a way to access the singular form so I can use access the taxonomy from a partial being aware of Site’s current language?

Currently I define a mapping in a Data file taxonomy_tags.yml:

en: tags
es: etiquetas

And then access it from a shortcode like:

{{$tags_taxonomy := index $.Site.Data.taxonomy_tags $.Site.Language.Lang }}
{{$tags := $.Page.GetTerms $tags_taxonomy}}
<strong>{{ T "tag" (len $tags)}}</strong>
{{ range $i, $tag := $tags }}
{{if gt $i 0}},{{end}} <a href="{{ $tag.Permalink }}">{{ title $tag.LinkTitle }}</a> 
{{ end }}

Is there any other way to avoid maintaining a data file with mappings and have the above functionality?
Using the above set up at simpleit-hugo-theme/layouts/partials/list_tags_in_page.html theme.

It would try to use different taxonomies per language in Frontmatter

EN-pages
tag = [“wines”, “red”]

ES-pages
etiquetas = [“vino”, “tinto”]

Thanks for your answer, that is what I am already doing, the problem is how to create a partial that process tags that works for English and Spanish without hardcoding “tag” or “etiquetas” in it.

you have to create different taxonomy templates!

Copy temlates from layouts/tags to layouts/etiquetas
for template naming look in

I want to have a single shortcode that gets taxonomy information from config.toml so I avoid code duplication and maintenance of different files for each taxonomy.

??

translation only does not work without mappings?