private static function parse(File $file) {

		$lines 		= explode("\n", $file -> getContent());
		$languages 	= [];

		foreach($lines as $index => $line) {
			
			$line = trim($line);

			if('' === $line) {
				continue;
			}

			//Check for language format
			preg_match('#^\[([a-z_\-0-9]+)\]#i', $line, $language);

			if(count($language) === 2) {
				
				$lg = $language[1];
				$languages[$lg] = [];

				continue;
			}

			//If there is no language found
			if(false === isset($lg)) {
				return trigger_error(sprintf('Missing language title in translation file "%s" on line %s', $file -> entity() -> getBasepath(), ++$index), E_USER_ERROR);
			}
			
			//Match the format (key value) on a single translation line
			preg_match('#^(\'|")(.*)(\1)\s+(\'|")(.*)(\3)$#', $line, $match);

			if(count($match) !== 7) {
				return trigger_error(sprintf('Incorrect format in translation file "%s" on line %s', $file -> entity() -> getBasepath(), ++$index), E_USER_ERROR);
			}

			$languages[$lg][$match[2]] = $match[5];
		}

		return $languages;
	}
private static function parse(File $file) {

		$lines 		= explode("\n", $file -> getContent());
		$languages 	= [];

		foreach($lines as $index => $line) {
			
			$line = trim($line);

			if('' === $line) {
				continue;
			}

			//Check for language format
			preg_match('#^\[([a-z_\-0-9]+)\]#i', $line, $language);

			if(count($language) === 2) {
				
				$lg = $language[1];
				$languages[$lg] = [];

				continue;
			}

			//If there is no language found
			if(false === isset($lg)) {
				return trigger_error(sprintf('Missing language title in translation file "%s" on line %s', $file -> entity() -> getBasepath(), ++$index), E_USER_ERROR);
			}
			
			//Match the format (key value) on a single translation line
			preg_match('#^(\'|")(.*)(\1)\s+(\'|")(.*)(\3)$#', $line, $match);

			if(count($match) !== 7) {
				return trigger_error(sprintf('Incorrect format in translation file "%s" on line %s', $file -> entity() -> getBasepath(), ++$index), E_USER_ERROR);
			}

			$languages[$lg][$match[2]] = $match[5];
		}

		return $languages;
	}
private static function parse ( File $ file ) { $ lines = explode ( "\n" , $ file -> getContent ( ) ) ; $ languages = [ ] ; foreach ( $ lines as $ index => $ line ) { $ line = trim ( $ line ) ; if ( '' === $ line ) { continue ; } //Check for language format
 preg_match ( '#^\[([a-z_\-0-9]+)\]#i' , $ line , $ language ) ; if ( count ( $ language ) === 2 ) { $ lg = $ language [ 1 ] ; $ languages [ $ lg ] = [ ] ; continue ; } //If there is no language found
 if ( false === isset ( $ lg ) ) { return trigger_error ( sprintf ( 'Missing language title in translation file "%s" on line %s' , $ file -> entity ( ) -> getBasepath ( ) , ++ $ index ) , E_USER_ERROR ) ; } //Match the format (key value) on a single translation line
 preg_match ( '#^(\'|")(.*)(\1)\s+(\'|")(.*)(\3)$#' , $ line , $ match ) ; if ( count ( $ match ) !== 7 ) { return trigger_error ( sprintf ( 'Incorrect format in translation file "%s" on line %s' , $ file -> entity ( ) -> getBasepath ( ) , ++ $ index ) , E_USER_ERROR ) ; } $ languages [ $ lg ] [ $ match [ 2 ] ] = $ match [ 5 ] ; } return $ languages ; }
Parses a translation file and converts it into an array
@param sFire\System\File $file
@return array
Parses a translation file and converts it into an array