C. Scott Ananian has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/334195 )
Change subject: WIP: Implement {{PAGELANGUAGE}} ...................................................................... WIP: Implement {{PAGELANGUAGE}} Infrastructure needed for LanguageConverter support, since conversion is enabled based on whether the page language has variants. FIXME: not sure that the pagelanguage returned by the API is actually correct; see https://phabricator.wikimedia.org/T59603#2970423 Bug: T59603 Change-Id: I26d7972a54a214a17bb92d735aa41f1b030a38d6 --- M lib/mw/ApiRequest.js M lib/wt2html/tt/ParserFunctions.js 2 files changed, 10 insertions(+), 2 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/parsoid refs/changes/95/334195/1 diff --git a/lib/mw/ApiRequest.js b/lib/mw/ApiRequest.js index 2e4b440..7261a55 100644 --- a/lib/mw/ApiRequest.js +++ b/lib/mw/ApiRequest.js @@ -585,6 +585,8 @@ metadata.ns = page.ns; metadata.latest = page.lastrevid; metadata.revision = page.revisions[0]; + metadata.pagelanguage = page.pagelanguage; + metadata.pagelanguagedir = page.pagelanguagedir; if (metadata.revision.texthidden || !metadata.revision.hasOwnProperty("*")) { error = new DoesNotExistError("Source is hidden for " + self.title); diff --git a/lib/wt2html/tt/ParserFunctions.js b/lib/wt2html/tt/ParserFunctions.js index 38342d9..3981d8b 100644 --- a/lib/wt2html/tt/ParserFunctions.js +++ b/lib/wt2html/tt/ParserFunctions.js @@ -746,6 +746,10 @@ var target = args[0].k; cb({ tokens: [ target || this.env.page.name || '' ] }); }; +ParserFunctions.prototype.pf_pagelanguage = function(token, frame, cb, args) { + // The language (code) of the current page. + cb({ tokens: [ this.env.page.language || 'en' ] }); +}; // This should be doable with the information in the envirionment // (this.env) already. ParserFunctions.prototype.pf_fullurl = function(token, frame, cb, args) { @@ -810,8 +814,10 @@ var target = args[0].k; cb({ tokens: [target] }); }; -ParserFunctions.prototype.pf_contentlang = function(token, frame, cb, args) { - cb({ tokens: ['en'] }); +ParserFunctions.prototype.pf_contentlang = +ParserFunctions.prototype.pf_contentlanguage = function(token, frame, cb, args) { + // The wiki's default interface language ($wgLanguageCode) + cb({ tokens: [ this.env.conf.wiki.lang || 'en' ] }); }; ParserFunctions.prototype.pf_numberoffiles = function(token, frame, cb, args) { cb({ tokens: ['2'] }); -- To view, visit https://gerrit.wikimedia.org/r/334195 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I26d7972a54a214a17bb92d735aa41f1b030a38d6 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/parsoid Gerrit-Branch: master Gerrit-Owner: C. Scott Ananian <canan...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits