Page MenuHomePhabricator

Feature request: add detection for page language to Scribunto
Open, Needs TriagePublic

Description

Recently, {{PAGELANGUAGE}} has been introduced.

I want to query this property similar to mw.language.getContentLanguage() as mw.language.getPageLanguage() (might be almost identical on regular wikis, but could differ on wikis with translate features).

I am not happy being forced on frame:preprocess() hacks.

Actually, I want this for the current page only. A more widened approach would be to have a pile of page properties of any page, accessed by mw.title, including redirect, disambiguation, content model or defaultsort attributes.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptApr 2 2017, 9:44 AM
Anomie added a subscriber: Anomie.Apr 3 2017, 4:58 PM

mw.title objects already have isRedirect and contentModel, pageLanguage would fit well there.

Change 346176 had a related patch set uploaded (by Anomie):
[mediawiki/extensions/Scribunto@master] mw.title: Add pageLanguage property

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

Rical added a subscriber: Rical.Apr 7 2017, 7:48 AM
Rical added a comment.Apr 7 2017, 8:10 AM

We could have mw.language.getUserLanguage() with getContentLanguage() and getPageLanguage() to complete languages needs of any modules. See T68051.

Anomie added a comment.Apr 7 2017, 1:26 PM

User language is off topic for this task.

Kaganer added a subscriber: Kaganer.Nov 5 2019, 1:15 PM
Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptNov 5 2019, 1:15 PM

Please note: I'm seen https://www.mediawiki.org/wiki/Extension:LanguageCode that a realize two magic Words:

{{USERLANGUAGE}} - for a display the user language (see T4085 for this issue)
{{PAGELANGUAGE}} - for a display the page language
I have not reviewed the source code, but maybe this is a solution for this issue.

Uzume assigned this task to Anomie.Jun 21 2020, 1:42 PM
Uzume triaged this task as Medium priority.
Uzume added a subscriber: Uzume.

@Anomie Can we get your change from over three years ago merged? This is an easy and straightforward fix but Gerrit is reporting some sort of merge conflict even though Jenkins had no issues with it.

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

Aklapper removed Anomie as the assignee of this task.Jun 22 2020, 3:59 AM
Aklapper raised the priority of this task from Medium to Needs Triage.
Aklapper edited projects, added Patch-Needs-Improvement; removed Patch-For-Review.

@Uzume: Please don't prioritize tasks and assign tasks without assignee consent - thanks!

Pppery added a subscriber: Pppery.Jun 22 2020, 2:12 PM

@Anomie Can we get your change from over three years ago merged? This is an easy and straightforward fix but Gerrit is reporting some sort of merge conflict even though Jenkins had no issues with it.

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

Jenkins had no issues with the patch because it ran in 2017, when there wasn't a merge conflict. I've told Jenkins to run again, and it's now properly failing.

Pppery removed a subscriber: Pppery.Jun 22 2020, 2:12 PM
Uzume added a subscriber: Pppery.

@Aklapper Does it really need triage? There was already a patch for it (thought it seems to need to be updated). I can see how the patch itself needs triage but the issue seems well understood. Anomie already clarified that mw.language.getPageLanguage was not the right thing and demonstrated that a pageLanguage field of mw.title objects was the way to go. What further triage does this issue really need? I only assigned it to Anomie so that he would respond based on the patch he created. I understand if he wanted to remove himself at this point in time but the point was to get him to make such a statement.

@Pppery Thanks for forcing the rebuild. I never assumed the conflict was not there. I just noticed it was not originally there. I really wonder why it was never merged.

In any event, I believe what needs to be done it clear. Short of attempting to make a new patch myself (I do not really have a proper Mediawiki development and test environment set up), how to I facilitate forward action on this? Thank you.

Please do not remove valid project tags and do not replace them by wrong tags - thanks.

Pppery removed a subscriber: Pppery.Jun 23 2020, 1:30 PM
Uzume added a comment.Jun 26 2020, 4:58 AM

I actually did not do that. I think somehow I must have edited/submitted and older version (though I am not sure how as that was not my intention).

Aklapper removed a subscriber: Anomie.Oct 16 2020, 5:01 PM