Topic on Project:Village Pump

Template:Bundled/fi doesn't exist while most of it's translations does

12
Summary last edited by Clump 22:59, 2 May 2022 1 year ago
Jouluntähti (talkcontribs)
Ciencia Al Poder (talkcontribs)
Pppery (talkcontribs)

Noting that this was filed as phab:T301764 (which I failed to notice originally and filed a duplicate task, oops)

Nikerabbit (talkcontribs)

The issue is that <translate> tags are used inside JSON content (templatedata), which is not safe. You can avoid issues with <translate nowrap>, but that isn't fully safe either.

Ciencia Al Poder (talkcontribs)

I've added all the existing translations to templatedata directly. I haven't marked the page for translation yet in case someone wants to double-check (since marking for translation would delete the units). But otherwise it should fix the problem once it gets marked for translation.

We should find other instances of translate tags inside templatedata, and be sure the relevant people adding those tags are aware of the problem. cc @Wladek92, @Shirayuki

Wladek92 (talkcontribs)

Thanks for warning. I rather update the template data form when it exists but the remark is good to know.

Christian 🇫🇷 FR (talk) 17:12, 22 February 2022 (UTC)

Shirayuki (talkcontribs)
Wladek92 (talkcontribs)

do we update tag:templatedata ? may be risk of duplicate if "{{PAGELANGUAGE}}" remains

Christian 🇫🇷 FR (talk) 21:52, 22 February 2022 (UTC)

Pppery (talkcontribs)

Would it be a good idea to write a Lua module than converts translations from the form the Translate extension produces to the form TemplateData expects?

Ciencia Al Poder (talkcontribs)

If I'm not mistaken, such module would require to fetch individual translations from all languages the page has been translated to. That would be one expensive call per language per unit, where we have one unit per parameter and one for the template alone. This can quickly escalate to the current limit of costly calls, which is 500.

Jdforrester (WMF) (talkcontribs)

Thank you to @Shirayuki for fixing both of these mistakes.

Tacsipacsi (talkcontribs)

I haven't marked the page for translation yet in case someone wants to double-check (since marking for translation would delete the units).

The unit pages themselves aren’t automatically deleted, e.g. Translations:Template:Bundled/11/fi still exists, so reverting the edits would restore the translations (although as far as I remember, fuzzy state is lost when the unit is removed and later re-added).

That would be one expensive call per language per unit, where we have one unit per parameter and one for the template alone.

Somewhat silly, but I think template transclusion doesn’t count to that limit (there are other limits on template transclusion, though). So going through all languages, trying to transclude the translations and catching the exception if it doesn’t exist could actually work without reaching the limit. (Although it could make sense to go through the languages, check with #ifexist’s Lua equivalent if the template itself (not a translation unit) exists in that language, and going through only the translation units that may realistically exist. This way we go over 300 languages only once, the rest of the loops go over only the existing few or few dozen languages.)