public function validate($file, $key, $against_language, $validate_language)
	{
		if (gettype($against_language) !== gettype($validate_language))
		{
			$this->output->addMessage(Output::FATAL, sprintf('Key should be type %s but is type %s', gettype($against_language), gettype($validate_language)), $file, $key);
			return;
		}

		if ($key === 'PLURAL_RULE')
		{
			if ($validate_language < 0 || $validate_language > 15)
			{
				$this->output->addMessage(Output::FATAL, sprintf('The plural rule %d, which you are trying to use, does not exist. For more information see https://wiki.phpbb.com/Plural_Rules.', $validate_language), $file, $key);
				return;
			}
		}
		else if ($key === 'DIRECTION')
		{
			if (!in_array($validate_language, array('ltr', 'rtl')))
			{
				$this->output->addMessage(Output::FATAL, sprintf('The text direction %s, which you are trying to use, does not exist. Currently only ltr (left-to-right) and rtl (right-to-left) are allowed.', $validate_language), $file, $key);
				return;
			}
		}
		else if ($key === 'USER_LANG')
		{
			if (str_replace('_', '-', $this->originIso) !== $validate_language && strpos($validate_language, $this->originIso . '-') !== 0)
			{
				$this->output->addMessage(Output::FATAL, sprintf('The user language %s, which you are trying to use, does not match the language.', $validate_language), $file, $key);
				return;
			}
		}
		else if (gettype($against_language) === 'string')
		{
			$this->validateString($file, $key, $against_language, $validate_language);
		}
		else
		{
			$this->validateArray($file, $key, $against_language, $validate_language);
		}
	}
public function validate($file, $key, $against_language, $validate_language)
	{
		if (gettype($against_language) !== gettype($validate_language))
		{
			$this->output->addMessage(Output::FATAL, sprintf('Key should be type %s but is type %s', gettype($against_language), gettype($validate_language)), $file, $key);
			return;
		}

		if ($key === 'PLURAL_RULE')
		{
			if ($validate_language < 0 || $validate_language > 15)
			{
				$this->output->addMessage(Output::FATAL, sprintf('The plural rule %d, which you are trying to use, does not exist. For more information see https://wiki.phpbb.com/Plural_Rules.', $validate_language), $file, $key);
				return;
			}
		}
		else if ($key === 'DIRECTION')
		{
			if (!in_array($validate_language, array('ltr', 'rtl')))
			{
				$this->output->addMessage(Output::FATAL, sprintf('The text direction %s, which you are trying to use, does not exist. Currently only ltr (left-to-right) and rtl (right-to-left) are allowed.', $validate_language), $file, $key);
				return;
			}
		}
		else if ($key === 'USER_LANG')
		{
			if (str_replace('_', '-', $this->originIso) !== $validate_language && strpos($validate_language, $this->originIso . '-') !== 0)
			{
				$this->output->addMessage(Output::FATAL, sprintf('The user language %s, which you are trying to use, does not match the language.', $validate_language), $file, $key);
				return;
			}
		}
		else if (gettype($against_language) === 'string')
		{
			$this->validateString($file, $key, $against_language, $validate_language);
		}
		else
		{
			$this->validateArray($file, $key, $against_language, $validate_language);
		}
	}
public function validate ( $ file , $ key , $ against_language , $ validate_language ) { if ( gettype ( $ against_language ) !== gettype ( $ validate_language ) ) { $ this -> output -> addMessage ( Output :: FATAL , sprintf ( 'Key should be type %s but is type %s' , gettype ( $ against_language ) , gettype ( $ validate_language ) ) , $ file , $ key ) ; return ; } if ( $ key === 'PLURAL_RULE' ) { if ( $ validate_language < 0 || $ validate_language > 15 ) { $ this -> output -> addMessage ( Output :: FATAL , sprintf ( 'The plural rule %d, which you are trying to use, does not exist. For more information see https://wiki.phpbb.com/Plural_Rules.' , $ validate_language ) , $ file , $ key ) ; return ; } } else if ( $ key === 'DIRECTION' ) { if ( ! in_array ( $ validate_language , array ( 'ltr' , 'rtl' ) ) ) { $ this -> output -> addMessage ( Output :: FATAL , sprintf ( 'The text direction %s, which you are trying to use, does not exist. Currently only ltr (left-to-right) and rtl (right-to-left) are allowed.' , $ validate_language ) , $ file , $ key ) ; return ; } } else if ( $ key === 'USER_LANG' ) { if ( str_replace ( '_' , '-' , $ this -> originIso ) !== $ validate_language && strpos ( $ validate_language , $ this -> originIso . '-' ) !== 0 ) { $ this -> output -> addMessage ( Output :: FATAL , sprintf ( 'The user language %s, which you are trying to use, does not match the language.' , $ validate_language ) , $ file , $ key ) ; return ; } } else if ( gettype ( $ against_language ) === 'string' ) { $ this -> validateString ( $ file , $ key , $ against_language , $ validate_language ) ; } else { $ this -> validateArray ( $ file , $ key , $ against_language , $ validate_language ) ; } }
Validates type of the language and decides on further validation

@param	string	$file		File to validate
@param	string	$key		Key to validate
@param	mixed	$against_language		Original language
@param	mixed	$validate_language		Translated language
@return	null
Validates type of the language and decides on further validation