Closed lebmich closed 3 years ago
Did you translate the image path or image file name? That'll cause it not to work.
On April 2, 2021 9:44:51 AM PDT, Michel Leblond @.***> wrote:
In the French translation no link to the images works. For example, I get:
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/darktable-org/dtdocs/issues/249
I translated nothings at all. The link to the image in my browser is:
@elstoc I've been looking at this problem for a while, and I don't see the solution. Hopefully I'm missing something obvious.
Because of the decision we made about storing images in a folder with the same name as the file, we use {{ .Page.RelPermalink }}
j + the image file name to construct the image URL for English text. But when we translate the page, {{ .Page.RelPermalink }}
includes the translated locale, e.g. fr-fr
, in the URL.
I guess the proper solution would be to check if there is a translated image, and if no, then fall back to the English URL.
Any ideas?
Haven't we decided already that it's not possible to translate the images? If so, surely the render-image partial can check if the page is non-English using .Page.Language
and then if not, loop through .Page.Translations
until it finds the English version (with .Lang
), then use the .RelPermaLink
to build the link using that page instead.
Haven't we decided already that it's not possible to translate the images?
Yes, I believe so.
This is a good thread: https://discourse.gohugo.io/t/how-to-get-a-specific-translation/32433/5
I've tried a few of those, but it doesn't work. The most promising seems to be {{ $p := index (where .Page.AllTranslations "Language.Lang" "en-US") 0 }}
with {{ $p.RelPermalink }}
but that doesn't work.
A quick test shows that it seems to work. I will do more in-depth testing this evening. Thank you so much.
Please reopen this issue if there is a problem, but it looks fixed to me.
In the French translation no link to the images works. For example, I get: