<?php
/**
- * ResourceLoader module for populating language specific data.
- *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
*
* @file
* @author Santhosh Thottingal
- * @author Timo Tijhof
*/
/**
* @return string JavaScript code
*/
public function getScript( ResourceLoaderContext $context ) {
- $fileScript = parent::getScript( $context );
- $langDataScript = Xml::encodeJsCall(
- 'mw.language.setData',
- [
- $context->getLanguage(),
- $this->getData( $context )
- ],
- ResourceLoader::inDebugMode()
- );
- return $fileScript . $langDataScript;
+ return parent::getScript( $context )
+ . 'mw.language.setData('
+ . ResourceLoader::encodeJsonForScript( $context->getLanguage() ) . ','
+ . ResourceLoader::encodeJsonForScript( $this->getData( $context ) )
+ . ');';
}
/**