3 * Resource loader module for populating special characters data for some
4 * editing extensions to use.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
25 * Resource loader module for populating special characters data for some
26 * editing extensions to use.
28 class ResourceLoaderSpecialCharacterDataModule
extends ResourceLoaderModule
{
29 private $path = "resources/src/mediawiki.language/specialcharacters.json";
30 protected $targets = array( 'desktop', 'mobile' );
33 * Get all the dynamic data.
37 protected function getData() {
39 return json_decode( file_get_contents( "$IP/{$this->path}" ) );
43 * @param ResourceLoaderContext $context
44 * @return string JavaScript code
46 public function getScript( ResourceLoaderContext
$context ) {
47 return Xml
::encodeJsCall(
48 'mw.language.setSpecialCharacters',
52 ResourceLoader
::inDebugMode()
57 * @param ResourceLoaderContext $context
58 * @return int UNIX timestamp
60 public function getModifiedTime( ResourceLoaderContext
$context ) {
61 return static::safeFilemtime( $this->path
);
65 * @param ResourceLoaderContext $context
68 public function getModifiedHash( ResourceLoaderContext
$context ) {
69 return md5( serialize( $this->getData() ) );
75 public function getDependencies() {
76 return array( 'mediawiki.language' );
82 public function getMessages() {
84 'special-characters-group-latin',
85 'special-characters-group-latinextended',
86 'special-characters-group-ipa',
87 'special-characters-group-symbols',
88 'special-characters-group-greek',
89 'special-characters-group-cyrillic',
90 'special-characters-group-arabic',
91 'special-characters-group-arabicextended',
92 'special-characters-group-persian',
93 'special-characters-group-hebrew',
94 'special-characters-group-bangla',
95 'special-characters-group-tamil',
96 'special-characters-group-telugu',
97 'special-characters-group-sinhala',
98 'special-characters-group-devanagari',
99 'special-characters-group-gujarati',
100 'special-characters-group-thai',
101 'special-characters-group-lao',
102 'special-characters-group-khmer',
103 'special-characters-title-endash',
104 'special-characters-title-emdash',
105 'special-characters-title-minus'