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.

Details

Related Gerrit Patches:
mediawiki/extensions/Scribunto : mastermw.title: Add pageLanguage property

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.