Template talk:HadLiquidThreads
Appearance
Latest comment: 1 year ago by Jon Harald Søby in topic Marking for translation
Marking for translation
@Tacsipacsi: Hi! MarcoAurelio asked me to mark this template for translation, which I'll gladly do, but I don't understand the syntax at the start. Why is there {{#switch:<translate></translate>
(with no content inside the translate tags – which would become after marking for translation, but that shouldn't matter), and why is the template content inside an unnamed (null) parameter to that switch statement? Jon Harald Søby (talk) 13:54, 4 September 2023 (UTC)
- It’s to differentiate between this very page and a translation being transcluded.
{{#switch:
is a magic word, and doesn’t have parameters in the sense templates have – what you call an “unnamed (null) parameter”, is actually a switch case matching the empty string. Translation pages (including /en) have<translate>
tags removed, so all that remains is{{#switch:
, without any content between the:
and the|
in the next line (there won’t be any content inside the tags even after marking for translation, because empty<translate>
tags don’t get<!--T:id-->
s), making the empty case match, and the real content to be rendered. When this very page is transcluded, however, nothing happens to the<translate>
tags, they remain there as garbage, so the empty case doesn’t match, only the#default
case – which transcludes the appropriate translation page in the UI language. Please note that for this to work, this very page needs to be transcluded directly, so you need to turn off translation-aware transclusion. - This technique is used a few times on Meta, when templates should be transcluded in the UI language (and used to be used a lot before translation-aware transclusion became a thing), maybe looking at one of these templates helps you understand how it works. It’s hackish, but unfortunately translation-aware transclusion only supports transcluding in the page language, and the page language of talk pages is almost always English. —Tacsipacsi (talk) 20:03, 4 September 2023 (UTC)
- @Tacsipacsi: Aight, thanks for the explanation, I think I understand it now. I was not aware an empty <translate> tag would not get a T:id comment (or, indeed, not appear in Special:Translate for that page, apparently). So we'll give it a go. :-) Jon Harald Søby (talk) 00:30, 5 September 2023 (UTC)
- Thanks, but you seem to have forgot to disable translation-aware transclusion.
<!--T:id-->
comments belong to translation units, not pairs of<translate>
tags. I’m sure you’re aware that there can be more than one<!--T:id-->
within a<translate>
block – having less than one is analogous to that. —Tacsipacsi (talk) 01:11, 5 September 2023 (UTC)- @Tacsipacsi: Thanks, that explanation makes a lot of sense.
- I've re-marked the templeta for translation without translation-aware transclusion, and now it seems to work as it should. Thanks again! Jon Harald Søby (talk) 10:30, 6 September 2023 (UTC)
- @Tacsipacsi: Aight, thanks for the explanation, I think I understand it now. I was not aware an empty <translate> tag would not get a T:id comment (or, indeed, not appear in Special:Translate for that page, apparently). So we'll give it a go. :-) Jon Harald Søby (talk) 00:30, 5 September 2023 (UTC)