jenkins-bot has submitted this change and it was merged.
Change subject: Parse pages and text in context of user language
......................................................................
Parse pages and text in context of user language
and text in context of the current page the user is on, instead of "API".
This allows template-based i18n, until on-wiki i18n is fully supported
(e.g. with Gadgets 2.0) as well as using constructions that are
title-dependent like "[[{{TALKPAGENAME}}]]" to work.
Bug: 55664
Change-Id: I8f75c99a41674030881961e958d32cbe8c6bf4de
---
M modules/ext.guidedTour.lib.js
1 file changed, 16 insertions(+), 6 deletions(-)
Approvals:
Mattflaschen: Looks good to me, approved
jenkins-bot: Verified
diff --git a/modules/ext.guidedTour.lib.js b/modules/ext.guidedTour.lib.js
index 9d8e142..9fc143e 100644
--- a/modules/ext.guidedTour.lib.js
+++ b/modules/ext.guidedTour.lib.js
@@ -312,7 +312,7 @@
* @return {void}
*/
function callApi ( guider, source ) {
- var ajaxParams, data;
+ var ajaxParams, ajaxData, data;
if ( source !== 'page' && source !== 'text' ) {
mw.log( 'callApi called incorrectly' );
@@ -325,16 +325,26 @@
return;
}
+ ajaxData = {
+ format: 'json',
+ action: 'parse',
+ uselang: mw.config.get( 'wgUserLanguage' )
+ };
+ // Parse text in the context of the current page (and not API)
+ // This is for example useful if you'd like to link to the talk
page
+ // of the current page with [[{{TALKPAGENAME}}]].
+ // Can't do this on Special Pages due to Bug 49477
+ if ( mw.config.get( 'wgNamespaceNumber' ) !== -1 && source ===
'text' ) {
+ ajaxData.title = mw.config.get( 'wgPageName' );
+ }
+ ajaxData[source] = guider.description;
+
ajaxParams = {
async: false,
type: 'POST',
url: mw.util.wikiScript( 'api' ),
- data: {
- action: 'parse',
- format: 'json'
- }
+ data: ajaxData
};
- ajaxParams.data[source] = guider.description;
// parse (make synchronous API request)
data = $.parseJSON(
--
To view, visit https://gerrit.wikimedia.org/r/89499
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8f75c99a41674030881961e958d32cbe8c6bf4de
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GuidedTour
Gerrit-Branch: master
Gerrit-Owner: Rillke <[email protected]>
Gerrit-Reviewer: Mattflaschen <[email protected]>
Gerrit-Reviewer: Swalling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits