Multilingual Shortcode Recommendation

If I have a shortcode {{ < synopsis-foo > }} that exists in the /layouts/shortcodes directory that I include in multiple places across my en-us content, what is the recommended approach when I want to translate that shortcode and include it across content in my zh-cn content folder?

Here is the actual repo where I have my shortcodes.

For further detail… I have tried simply adding a zh variant:


…and although the hugo server shows that it detects and builds the file which includes the zh text, that zh text is not included when shortcode-foo is referenced elsewhere in the zh site.

I am still seeking input on this. I have a hack wherein we simply included copies of the content outside of the short-codes, but I’d rather have in in a single place instead of having multiple copies.

Now why do your shortcodes have a HTML and body tag? They are supposed to be placed within the contents’ HTML.

Anyway. Have a look at the transition of strings. So you make one shortcode synapsis and call it together with an argument {{% synapsis "Foo" %}}. Within that shortcode you get your translated text with {{ T (.Get 0) }}. Another probability is to store it as data and than call that data from the shortcode

The above should just work.