Page MenuHomePhabricator

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

Description

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

@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.

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.

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

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!