protected function loadMessages() {
		if ( $this->messages === null ) {
			$this->messages = array();
			foreach ( glob( "{$this->messageDirectory}/*.json" ) as $file ) {
				$lang = strtolower( substr( basename( $file ), 0, -5 ) );
				if ( $lang === 'qqq' ) {
					// Ignore message documentation
					continue;
				}

				if ( is_readable( $file ) ) {
					$json = file_get_contents( $file );
					if ( $json === false ) {
						$this->logger->error( 'Error reading file', array(
							'method' => __METHOD__,
							'file' => $file,
						) );
						continue;
					}

					$data = json_decode( $json, true );
					if ( $data === null ) {
						$this->logger->error( 'Error parsing json', array(
							'method' => __METHOD__,
							'file' => $file,
							'json_error' => json_last_error(),
						) );
						continue;
					}

					// Discard metadata
					unset( $data['@metadata'] );

					if ( empty( $data ) ) {
						// Ignore empty languages
						continue;
					}

					$this->messages[$lang] = $data;
				}
			}
		}
	}
protected function loadMessages() {
		if ( $this->messages === null ) {
			$this->messages = array();
			foreach ( glob( "{$this->messageDirectory}/*.json" ) as $file ) {
				$lang = strtolower( substr( basename( $file ), 0, -5 ) );
				if ( $lang === 'qqq' ) {
					// Ignore message documentation
					continue;
				}

				if ( is_readable( $file ) ) {
					$json = file_get_contents( $file );
					if ( $json === false ) {
						$this->logger->error( 'Error reading file', array(
							'method' => __METHOD__,
							'file' => $file,
						) );
						continue;
					}

					$data = json_decode( $json, true );
					if ( $data === null ) {
						$this->logger->error( 'Error parsing json', array(
							'method' => __METHOD__,
							'file' => $file,
							'json_error' => json_last_error(),
						) );
						continue;
					}

					// Discard metadata
					unset( $data['@metadata'] );

					if ( empty( $data ) ) {
						// Ignore empty languages
						continue;
					}

					$this->messages[$lang] = $data;
				}
			}
		}
	}
protected function loadMessages ( ) { if ( $ this -> messages === null ) { $ this -> messages = array ( ) ; foreach ( glob ( "{$this->messageDirectory}/*.json" ) as $ file ) { $ lang = strtolower ( substr ( basename ( $ file ) , 0 , - 5 ) ) ; if ( $ lang === 'qqq' ) { // Ignore message documentation continue ; } if ( is_readable ( $ file ) ) { $ json = file_get_contents ( $ file ) ; if ( $ json === false ) { $ this -> logger -> error ( 'Error reading file' , array ( 'method' => __METHOD__ , 'file' => $ file , ) ) ; continue ; } $ data = json_decode ( $ json , true ) ; if ( $ data === null ) { $ this -> logger -> error ( 'Error parsing json' , array ( 'method' => __METHOD__ , 'file' => $ file , 'json_error' => json_last_error ( ) , ) ) ; continue ; } // Discard metadata unset ( $ data [ '@metadata' ] ) ; if ( empty ( $ data ) ) { // Ignore empty languages continue ; } $ this -> messages [ $ lang ] = $ data ; } } } }
Load messages from message directory.
Load messages from message directory .