*/
class Languages {
/** @var array List of languages */
- protected $mLanguages; #
+ protected $mLanguages;
- /** @var array Raw list of the messages in each language */
+ /** @var array Raw list of the messages in each language */
protected $mRawMessages;
/** @var array Messages in each language (except for English), divided to groups */
* Load the list of languages: all the Messages*.php
* files in the languages directory.
*
- * @param $exif bool Treat the Exif messages?
+ * @param bool $exif Treat the Exif messages?
*/
function __construct( $exif = true ) {
require __DIR__ . '/messageTypes.inc';
/**
* Load the language file.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*/
protected function loadFile( $code ) {
if ( isset( $this->mRawMessages[$code] ) &&
$this->mNamespaceAliases[$code] = array();
$this->mMagicWords[$code] = array();
$this->mSpecialPageAliases[$code] = array();
+
+ $jsonfilename = Language::getJsonMessagesFileName( $code );
+ if ( file_exists( $jsonfilename ) ) {
+ $json = Language::getLocalisationCache()->readJSONFile( $jsonfilename );
+ $this->mRawMessages[$code] = $json['messages'];
+ }
+
$filename = Language::getMessagesFileName( $code );
if ( file_exists( $filename ) ) {
require $filename;
- if ( isset( $messages ) ) {
- $this->mRawMessages[$code] = $messages;
- }
if ( isset( $fallback ) ) {
$this->mFallback[$code] = $fallback;
}
* translated - messages which are either required or optional, but translated from
* English and needed.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*/
private function loadMessages( $code ) {
if ( isset( $this->mMessages[$code] ) ) {
* translated - messages which are either required or optional, but translated from
* English and needed.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return string The messages in this language.
*/
/**
* Get fallback language code for a specific language.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return string Fallback code.
*/
/**
* Get namespace names for a specific language.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array Namespace names.
*/
/**
* Get namespace aliases for a specific language.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array Namespace aliases.
*/
/**
* Get magic words for a specific language.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array Magic words.
*/
/**
* Get special page aliases for a specific language.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array Special page aliases.
*/
/**
* Get the untranslated messages for a specific language.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The untranslated messages for this language.
*/
/**
* Get the duplicate messages for a specific language.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The duplicate messages for this language.
*/
/**
* Get the obsolete messages for a specific language.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The obsolete messages for this language.
*/
/**
* Get the messages whose variables do not match the original ones.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The messages whose variables do not match the original ones.
*/
/**
* Get the messages which do not use plural.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The messages which do not use plural in this language.
*/
/**
* Get the empty messages.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The empty messages for this language.
*/
/**
* Get the messages with trailing whitespace.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The messages with trailing whitespace in this language.
*/
/**
* Get the non-XHTML messages.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The non-XHTML messages for this language.
*/
/**
* Get the messages which include wrong characters.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The messages which include wrong characters in this language.
*/
/**
* Get the messages which include dubious links.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The messages which include dubious links in this language.
*/
/**
* Get the messages which include unbalanced brackets.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The messages which include unbalanced brackets in this language.
*/
/**
* Get the untranslated namespace names.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The untranslated namespace names in this language.
*/
/**
* Get the project talk namespace names with no $1.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The problematic project talk namespaces in this language.
*/
/**
* Get the untranslated magic words.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The untranslated magic words in this language.
*/
/**
* Get the obsolete magic words.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The obsolete magic words in this language.
*/
/**
* Get the magic words that override the original English magic word.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The overriding magic words in this language.
*/
/**
* Get the magic words which do not match the case-sensitivity of the original words.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The magic words whose case does not match in this language.
*/
/**
* Get the untranslated special page names.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The untranslated special page names in this language.
*/
/**
* Get the obsolete special page names.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*
* @return array The obsolete special page names in this language.
*/
/**
* Load the messages group.
- * @param $group MessageGroup The messages group.
+ * @param MessageGroup $group The messages group.
*/
function __construct( MessageGroup $group ) {
$this->mMessageGroup = $group;
/**
* Load the language file.
*
- * @param $code string The language code.
+ * @param string $code The language code.
*/
protected function loadFile( $code ) {
if ( !isset( $this->mRawMessages[$code] ) ) {