Since 0.123.0 onwards, translationKey doesn’t work as before. Before I could just put a value like presentation in two files and they would be linked together, getting .IsTranslated as true, a list of .Translations etc. With 0.123.x, I can’t see how to make it work.
I see this happening in term pages, with one of the translations having diacritics (for example, “music” in en and “música” in pt). I didn’t test in other kinds of pages.
Inspecting translationKey value, I saw that for pages with no such field in frontmatter .TranslationKey returns the page’s logical path, always beginning with a /. So I tried to put / in my translation keys, as a test, and it worked, but only while the Hugo server was running. Stopping and starting it again breaks again the translation linking.
I discovered it because something I don’t know whether is a bug or by-design: starting with 0.123.0, taxonomy terms that have diacritics (like “música”) need to have that diacritics when creating a custom content file (like, categories/música/index.pt.md). Before 0.123.0 that was not the case, it was mandatory to not have any diacritics (so I had categories/musica/index.pt.md, attention to the lack of diacritics here). Even if it is by-design (perhaps it has to do with the new logical .Path), it would be nice to document this behaviour.
With the test site below, setting translationKey in front matter behaves as expected for all markdown files:
git clone --single-branch -b hugo-forum-topic-48829 https://github.com/jmooring/hugo-testing hugo-forum-topic-48829
cd hugo-forum-topic-48829
hugo server
In fact, no, it doesn’t — in term pages. I’ve run your test site, and yes, it correctly behaves in post pages. But in term pages (in this case, either /pt/categories/música/ or /en/categories/music/), it doesn’t find any translations, and it’s possible to see it from the rendered page: there’s no “English Portuguese” links to alternate between languages in those term pages.
Strictly speaking, yes, but in your test site, p1-foo.pt.md and p1.en.md are also two different objects (again, strictly speaking). Because conceptually, music and música are not different terms, but translations of a same term.
And again, although you’ve put a translationKey both in music and música content files, that key is ignored. I can’t see a rationale behind translationKey other than cases like this: connecting objects that are different from Hugo’s POV, but translations of a same object from user’s POV.
A fix for this will be available in the next release, but I still recommend using a single term across all languages, and translate via the term’s branch bundle titles.
Yes, it seems more elegant and simpler. I don’t exactly remember why I’ve chosen the other way, as it’s a side project in which I work from time to time and that decision was took by me-from-two-years-ago haha.
In fact I now remember why I’ve chosen the other way: to get correct URLs. In the “música/music” example this is a minor problem, but with “comunicação/presentation” this is much worse (these are academic terms, changing them in my site would be wrong).
Can I accomplish correct URLs with the recommended way, so “/musica” and “/music”, “/comunicacao” and “/presentation” linked to each other?
(I’ve already configured the taxonomy translation itself. And sorry for asking, I’m in a travel now and only will be able to experiment and test by myself in next Thursday, but I didn’t want to lose the momentum of this question…)