Page MenuHomePhabricator

Implement Lua alternative to {{int:Lang}} / wgUserLanguage
Closed, DuplicatePublic


mw.getContentLanguage().code -- Returns the content language.
mw.getCurrentFrame():preprocess("{{PAGELANGUAGE}}") -- Returns the page language.
mw.getCurrentFrame():preprocess( "{{int:Lang}}" ) -- Returns the user language.

@daniel and I were chatting about this earlier. Looks like some kind of hidden magic function is able to provide the language of the user in Lua instead of using {{int:Lang}}. Get it to work and switch all modules in the module namespace on Commons to use it

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptAug 12 2017, 5:42 PM

@daniel : Can you please improve/expand this one? In T98307 allowDataAccessInUserLanguage is not ticked yet, but it seems to be enabled?

{{int:lang}} is itself a hack, not built into mediawiki.

Ricordisamoa renamed this task from Implement LUA alternative to {{int:Lang}} to Implement Lua alternative to {{int:Lang}}.Aug 13 2017, 9:47 AM
Ricordisamoa updated the task description. (Show Details)
Ricordisamoa added a subscriber: Ricordisamoa.
Jarekt added a subscriber: Jarekt.Aug 14 2017, 5:29 PM

At the moment many Lua modules on Commons call frame:callParserFunction( "int", "lang" ). Converting it to Lua function would be great, as it would allow easier sharing of the codes with wikis that do not have MediaWiki:Lang set up, although all that I checked have it.

Rical added a subscriber: Rical.Sep 11 2017, 9:52 AM
Perhelion renamed this task from Implement Lua alternative to {{int:Lang}} to Implement Lua alternative to {{int:Lang}} / wgUserLanguage.Oct 5 2018, 8:38 PM
He7d3r added a subscriber: He7d3r.Feb 9 2019, 9:42 AM
Rical added a comment.Feb 11 2019, 9:15 AM

The language of the user is available everywhere in all wikis ... except in Scribunto. And it's probably easy to do. And it's been waiting for so long!

Restricted Application removed a subscriber: Liuxinyu970226. · View Herald TranscriptMay 6 2019, 1:34 PM
Krinkle changed the status of subtask T4085: Add a {{USERLANGUAGE}} magic word from Open to Stalled.May 9 2019, 4:10 PM
Dvorapa added a subscriber: Dvorapa.May 9 2019, 4:34 PM
Rical updated the task description. (Show Details)Mar 25 2020, 11:04 AM