Merge "Special:Upload should not crash on failing previews"
[mediawiki.git] / includes / resourceloader / ResourceLoaderSpecialCharacterDataModule.php
blob44371bbee22f7f96e28b3aada7aa8bd266cae2cb
1 <?php
2 /**
3 * ResourceLoader 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
21 * @file
24 /**
25 * ResourceLoader 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 = [ 'desktop', 'mobile' ];
32 /**
33 * Get all the dynamic data.
35 * @return array
37 protected function getData() {
38 global $IP;
39 return json_decode( file_get_contents( "$IP/{$this->path}" ) );
42 /**
43 * @param ResourceLoaderContext $context
44 * @return string JavaScript code
46 public function getScript( ResourceLoaderContext $context ) {
47 return Xml::encodeJsCall(
48 'mw.language.setSpecialCharacters',
50 $this->getData()
52 ResourceLoader::inDebugMode()
56 /**
57 * @return bool
59 public function enableModuleContentVersion() {
60 return true;
63 /**
64 * @param ResourceLoaderContext $context
65 * @return array
67 public function getDependencies( ResourceLoaderContext $context = null ) {
68 return [ 'mediawiki.language' ];
71 /**
72 * @return array
74 public function getMessages() {
75 return [
76 'special-characters-group-latin',
77 'special-characters-group-latinextended',
78 'special-characters-group-ipa',
79 'special-characters-group-symbols',
80 'special-characters-group-greek',
81 'special-characters-group-greekextended',
82 'special-characters-group-cyrillic',
83 'special-characters-group-arabic',
84 'special-characters-group-arabicextended',
85 'special-characters-group-persian',
86 'special-characters-group-hebrew',
87 'special-characters-group-bangla',
88 'special-characters-group-tamil',
89 'special-characters-group-telugu',
90 'special-characters-group-sinhala',
91 'special-characters-group-devanagari',
92 'special-characters-group-gujarati',
93 'special-characters-group-thai',
94 'special-characters-group-lao',
95 'special-characters-group-khmer',
96 'special-characters-title-endash',
97 'special-characters-title-emdash',
98 'special-characters-title-minus'