Page MenuHomePhabricator

Deep transcluded untranslated units should be wrapped with lang=""
Open, MediumPublicBUG REPORT

Description

When a translation unit is not available in the current page language, it is wrapped with e.g. <span lang="en" dir="ltr" class="mw-content-ltr">Not translated yet.</span> as a way to specify the language that is actually being included there.

The same wrapper is applied when the page is transcluded elsewhere, but not if that page is subsequently transcluded — leaving untranslated units to be indistinguishable from translated ones.

For example create the following two pages:

  1. [[Template:Langest]]:
<noinclude><languages /></noinclude>
<translate><!--T:1--> Translated in Template:Langest.</translate>
<translate><!--T:2--> Not translated in Template:Langest.</translate>
  1. [[Langtest]]:
<noinclude><languages /></noinclude>
<translate><!--T:1--> Translated in Langest.</translate>
<translate><!--T:2--> Not translated in Langest.</translate>

Translate both into another language (e.g. fr), but only translate the first message of each. The resulting HTML in [[Langtest/fr]] is:

<p>Translated to fr in Langest.
<span lang="en" dir="ltr" class="mw-content-ltr">Not translated in Langest.</span>
</p>
<p>Translated to fr in Template:Langest.
<span lang="en" dir="ltr" class="mw-content-ltr">Not translated in Template:Langest.</span>
</p>

This is correct, and wraps the untranslated units with lang="".

Now transclude that page in a third page, e.g. [[Langtest2]], with {{:Langtest}}, and the resulting HTML is:

<p>Translated in Langest.
Not translated in Langest.
</p>
<p>Translated in Template:Langest.
Not translated in Template:Langest.
</p>

i.e. there is no wrapper on the untranslated content.

Event Timeline

Samwilson changed the subtype of this task from "Feature Request" to "Bug Report".Aug 30 2024, 3:55 AM

This can be worked around by templates manually adding the info. For example, for T371098 we might need to add the following (which is also dependent on the {{dir}} template, annoyingly):

<span lang="{{TRANSLATIONLANGUAGE}}" dir="{{dir|{{TRANSLATIONLANGUAGE}}}}"><translate>Not translated in Template:Langest.</translate></span>

That'd also then duplicate the lang="" wrapper when there's less than two levels of transclusion (which is not invalid, but also not necessary).

Actually, that doesn't work. :( Because {{TRANSLATIONLANGUAGE}} ends up having the value of the translation page it's included in in that situation.

What's the language of Langtest2? To me it looks like it's picking up the English version, which means no wrappers are needed. The wrapper is not to indicate untranslated units, but to indicate language of the content if different from the context.