Page MenuHomePhabricator

Investigate: IP Info Feedback template returns broken syntax [8H]
Open, Stalled, Needs TriagePublicBUG REPORT

Description

Original problem

As discussed on Meta-Wiki, the feedback link from rEWME modules/ext.wikimediaMessages.ipInfo.hooks/feedback.js should be using {{int:lang}} instead of Special:MyLanguage, as suggested by @MusikAnimal so the template works properly. In addition, the title of the section should also be populated with something like Feedback from $username.

Proposed solution

Keep using Special:MyLanguage to leverage the language fallback chain, but explicitly use the /en English translation when the user's language is English.

Testing notes

Test this by clicking on the Feedback button in the IP infobox on Special:Contributions. The link will take you away from the wiki and to meta.

If the user's language[*] on the original wiki is English, the preloaded template should be in English and no longer contain <translate> tags (regardless of the user's language on meta).

If the user's language on the original wiki is not English, and their language on meta is also not English, the preloaded template should be in the user's language on meta (even if this is different from their language in the original wiki).

If the user's language on the original wiki is not English, but their language on meta is English, they will still encounter this bug. That is hopefully an acceptable compromise for leveraging the language fallback chain in other situations.

[ * ] i.e. the language in the uselang URL parameter, or if that isn't set then the user's preferred language from their preferences, or if that isn't set then the site language

Event Timeline

This seems to work:

https://meta.wikimedia.org/wiki/IP_Editing:_Privacy_Enhancement_and_Abuse_Mitigation/IP_Info_feature/Feedback?action=edit&section=new&preload=Template:IPInfoFeedback/{{int:lang}}&preloadtitle={{urlencode:Feedback from {{subst:REVISIONUSER}}}}

Change 777011 had a related patch set uploaded (by MarcoAurelio; author: MarcoAurelio):

[mediawiki/extensions/WikimediaMessages@master] Fix feedback link for IPInfo beta feature

https://gerrit.wikimedia.org/r/777011

Thanks for looking into this @MarcoAurelio and @MusikAnimal.

We used Special:MyLanguage for the reasons outlined in T296272. Essentially the ask was to use the user's preferred language, or an appropriate fallback language if the template was not translated into that language. using {{int:lang}} or {{PAGELANGUAGE}} won't find the template if the user is using a language for which the translation doesn't exist yet.

However, using a translatable template results in the issues outlined here and in T299936: Create a feedback link for the IP Info infobox.

@Niharika What would you like to do?

In addition, the title of the section should also be populated with something like Feedback from $username.

Perhaps this could be separated into a different task, so it can move ahead while the language issue is discussed here?

using {{int:lang}} or {{PAGELANGUAGE}} won't find the template if the user is using a language for which the translation doesn't exist yet

Good point, sorry I knew this just didn't think of it! You can use a different template like Template:IPInfoFeedback/subst to first check if the desired subpage of Template:IPInfoFeedback exists, and if so use it, otherwise post English. The source would be something like (untested):

{{{{#ifexist:Template:IPInfoFeedback/{{int:lang}}|Template:IPInfoFeedback/{{int:lang}}|Template:IPInfoFeedback/en}}}}

You may need to use safesubst here too. I don't think {{PAGELANGUAGE}} will work since the feedback page itself isn't translatable (nor do I think it should be).

After that is implemented, you just need to change the preload param to use the new substitution template, ala preload=Template:IPInfoFeedback/subst. I can help implement the subst template later if I have time (I'm going on holiday soon so no promises).

Thanks @MusikAnimal - that might be a helpful compromise.

The ask was to fall back to the most appropriate language, e.g. arz -> ar, as outlined in: https://www.mediawiki.org/wiki/Manual:Language#Fallback_languages . But I'll let @Niharika comment more from the product-requirements side of things.

Change 777011 abandoned by MarcoAurelio:

[mediawiki/extensions/WikimediaMessages@master] Fix feedback link for IPInfo beta feature

Reason:

A different approach is preferred, see Task.

https://gerrit.wikimedia.org/r/777011

Perhaps this could be separated into a different task, so it can move ahead while the language issue is discussed here?

Certainly. I've created T305530.

Thanks for filing the task, @MarcoAurelio. I understand the problem. If possible, I would really like us to be able to use the language fallback chain. I had a discussion with @Tchanders about this earlier today. We'll explore some ways to achieve this without losing the fallback chain if possible and if not, we can use the function @MusikAnimal helpfully suggested. :)

AGueyte renamed this task from IP Info Feedback template returns broken syntax to INVESTIGATE: IP Info Feedback template returns broken syntax.Apr 19 2022, 5:00 PM
AGueyte renamed this task from INVESTIGATE: IP Info Feedback template returns broken syntax to INVESTIGATE: IP Info Feedback template returns broken syntax [8H].
Tchanders renamed this task from INVESTIGATE: IP Info Feedback template returns broken syntax [8H] to Investigate: IP Info Feedback template returns broken syntax [8H].Apr 19 2022, 5:12 PM

Change 786980 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/WikimediaMessages@master] Update link to IPInfo feedback page

https://gerrit.wikimedia.org/r/786980

We can transclude the English translation of the template, without <translate> tags, using preload=Template:IPInfoFeedback/en when the user's language is English From https://www.mediawiki.org/wiki/Help:Extension:Translate/Page_translation_administration#Life_of_a_translatable_page:

There is also a translation page with the language code of the source language: it doesn't contain the extra tags and other markup related to page translation which are used in the translatable page source. This page is not linked from the interface, but it is handy for example when you want to transclude the page (typically for translatable templates) or export it. For example, the page you're on is available without markups at Help:Extension:Translate/Page translation administration/en.

This means we could do something like:

var language = mw.config.get( 'wgPageContentLanguage' );
var preload = language === 'en' ? 'Template:IPInfoFeedback/en' : 'Special:MyLanguage/Template:IPInfoFeedback';
feedbackUrl.searchParams.set( 'preload', preload );

Caveat:

  • The feedback link is on the wiki where the user is using IPInfo. language is calculated here.
  • Special:MyLanguage will look up the language on meta. This could still be English even if language was not. In these cases, the <translate> tags would still appear.

@Niharika Is this an acceptable edge case? If so, we can use the patch above.

Special:MyLanguage will look up the language on meta. This could still be English even if language was not.

@Tchanders can you explain this sentence please? Are we saying that if the translation for the wiki content language where feedback is being provided does not exist, it will fallback to English?

Special:MyLanguage will look up the language on meta. This could still be English even if language was not.

@Tchanders can you explain this sentence please? Are we saying that if the translation for the wiki content language where feedback is being provided does not exist, it will fallback to English?

If the user's language on the first wiki is French, it will link to Special:MyLanguage on meta. But if their language is English on meta, they will still see the <translate> tags. (Because Special:MyLanguage will link to the translation source page.)

Got it. Yes, I think we are okay with the caveats.

Will be good to note the expected workflows after your patch in the task for QA's ease.

Tchanders updated the task description. (Show Details)

Got it. Yes, I think we are okay with the caveats.

Will be good to note the expected workflows after your patch in the task for QA's ease.

Task description updated - thanks.

Change 786980 merged by jenkins-bot:

[mediawiki/extensions/WikimediaMessages@master] Update link to IPInfo feedback page

https://gerrit.wikimedia.org/r/786980

dom_walden added a subscriber: dom_walden.

I can confirm all the points in the Testing notes.

Just for clarity, this change means if your language on the original wiki is English but on meta it is not English, the preloaded text will be in English.

I also tested that the translation fallback chain still appears to work by setting my language on meta to be something that does not have a translation.

Test environment: https://en.wikipedia.beta.wmflabs.org WikimediaMessages – (793d53d) 19:12, 29 April 2022.

Pols12 reopened this task as Open.EditedMay 26 2022, 1:45 PM
Pols12 added a subscriber: Pols12.

Still present (EDIT: Mmh, I’m just seeing there is is a WONTFIX case in task description, probably this one).

If wgPageContentLanguage is a language which has no translation yet, source page is still returned.

An easy workaround is to target Special:MyLanguage/Template:IPInfoFeedback/en instead of Special:MyLanguage/Template:IPInfoFeedback.

Still present (EDIT: Mmh, I’m just seeing there is is a WONTFIX case in task description, probably this one).

If wgPageContentLanguage is a language which has no translation yet, source page is still returned.

An easy workaround is to target Special:MyLanguage/Template:IPInfoFeedback/en instead of Special:MyLanguage/Template:IPInfoFeedback.

Is what you are seeing the same as this (from the description)?:

If the user's language on the original wiki is not English, but their language on meta is English, they will still encounter this bug. That is hopefully an acceptable compromise for leveraging the language fallback chain in other situations.

Change 800119 had a related patch set uploaded (by Pols12; author: Pols12):

[mediawiki/extensions/WikimediaMessages@master] ipInfo: /en fallback for feedback link

https://gerrit.wikimedia.org/r/800119

An easy workaround is to target Special:MyLanguage/Template:IPInfoFeedback/en instead of Special:MyLanguage/Template:IPInfoFeedback.

No, it doesn’t improve the situation: Special:MyLanguage/Template:IPInfoFeedback/en redirects to Template:IPInfoFeedback (there is an explicit special casing in Special:MyLanguage’s code that redirects to the page without language suffix if the site language is requested). Instead of a ton of workarounds, I think simply EditPage should be fixed to not load the base page under any circumstances (after which 9aefe55f179d502c169e9f2f5f138f96573c2a57 can be reverted): T309329: Preloading with Special:MyLanguage broken when the UI language is same as the content language.

Is what you are seeing the same as this (from the description)?:

If the user's language on the original wiki is not English, but their language on meta is English, they will still encounter this bug. That is hopefully an acceptable compromise for leveraging the language fallback chain in other situations.

I am using zh-cn as interface language here and the link is also here on Meta.

Please change your interface language to zh-cn. Then visit:
https://meta.wikimedia.org/wiki/Special:MyLanguage/Template:IPInfoFeedback → gives Template:IPInfoFeedback
https://meta.wikimedia.org/wiki/Special:MyLanguage/Template:IPInfoFeedback/en → gives Template:IPInfoFeedback/en

@Tacsipacsi My patch does not fix the case where Meta-Wiki interface language is en (described as WONTFIX in this task description), bt it does fix the case where Meta-Wiki interface language is zh-cn, or any language which is not an available translation for Template:IPInfoFeedback.

Oh, you’re right, I didn’t test this (I thought that the fallback to English works the same regardless of whether it “falls back” from English or any other language). However, I still think that adding more and more workarounds is not the right direction.

There’s still work to do after resolving T309329: the hack(s) (9aefe55, I241054cc1a18059a4d40cd2aee075c95f00c6d34 if it gets merged) need to be reverted.

Change 800119 abandoned by Pols12:

[mediawiki/extensions/WikimediaMessages@master] ipInfo: /en fallback for feedback link

Reason:

Would create another fallback issue.

https://gerrit.wikimedia.org/r/800119

Change 807548 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/extensions/WikimediaMessages@master] Remove IPInfo hook's hack for preloading a translatable template

https://gerrit.wikimedia.org/r/807548

Change 807548 merged by jenkins-bot:

[mediawiki/extensions/WikimediaMessages@master] Remove IPInfo hook's hack for preloading a translatable template

https://gerrit.wikimedia.org/r/807548