I have translated 11 strings of total 15 strings of Template:Bundled to Finnish. Page Template:Bundled/fi still doesn't exist, despite the first translations made by me on 5 February and the display title string have also been translated since 5 Feb. Why doesn't it still exist?
Topic on Project:Village Pump
Appearance
I don't see any obvious reason for this. It should probably be reported on Phabricator
Noting that this was filed as phab:T301764 (which I failed to notice originally and filed a duplicate task, oops)
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.
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
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)
The following pages contain <translate>
tags and {{PAGELANGUAGE}}
inside templatedata:
do we update tag:templatedata ? may be risk of duplicate if "{{PAGELANGUAGE}}" remains
Christian 🇫🇷 FR (talk) 21:52, 22 February 2022 (UTC)
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?
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.
Thank you to @Shirayuki for fixing both of these mistakes.
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.)