public static function load($source) {

		if(false === is_string($source) && false === $source instanceof Viewmodel) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or instance of sFire\MVC\Viewmodel, "%s" given', __METHOD__, gettype($source)), E_USER_ERROR);
		}

		$file = $source;

		if($source instanceof Viewmodel) {

			$path 			= Path :: get('modules') . Router :: getRoute() -> getModule() . DIRECTORY_SEPARATOR;
			$views 			= $path . Application :: get(['directory', 'view']);
			$translations 	= $path . Application :: get(['directory', 'translation']);
			$extension 		= Application :: get(['extensions', 'view']);
			$file  			= preg_replace('#^'. preg_quote($views) .'#', '', $source -> getFile());
			$file  			= preg_replace('#'. preg_quote($extension) .'$#', '', $file);
		}

		$module 	= Router :: getRoute() -> getModule();
		$extension 	= Application :: get(['extensions', 'translation']);
		$file 		= str_replace('.', DIRECTORY_SEPARATOR, $file);
		$file 		= Path :: get('modules') . $module . DIRECTORY_SEPARATOR . Application :: get(['directory', 'translation']) . $file . $extension;
		$file 		= new File($file);
		$identifier = md5($file -> entity() -> getBasepath());
		$cache 		= new File(Path :: get('cache-translation') . $identifier);

		if(false === $file -> exists() && false === $source instanceof Viewmodel) {
			return trigger_error(sprintf('Translation file "%s" used in %s() does not exists', $file -> entity() -> getBasepath(), __METHOD__), E_USER_ERROR);
		}

		static :: cache($cache, $file);

		return $identifier;
	}
public static function load($source) {

		if(false === is_string($source) && false === $source instanceof Viewmodel) {
			return trigger_error(sprintf('Argument 1 passed to %s() must be of the type string or instance of sFire\MVC\Viewmodel, "%s" given', __METHOD__, gettype($source)), E_USER_ERROR);
		}

		$file = $source;

		if($source instanceof Viewmodel) {

			$path 			= Path :: get('modules') . Router :: getRoute() -> getModule() . DIRECTORY_SEPARATOR;
			$views 			= $path . Application :: get(['directory', 'view']);
			$translations 	= $path . Application :: get(['directory', 'translation']);
			$extension 		= Application :: get(['extensions', 'view']);
			$file  			= preg_replace('#^'. preg_quote($views) .'#', '', $source -> getFile());
			$file  			= preg_replace('#'. preg_quote($extension) .'$#', '', $file);
		}

		$module 	= Router :: getRoute() -> getModule();
		$extension 	= Application :: get(['extensions', 'translation']);
		$file 		= str_replace('.', DIRECTORY_SEPARATOR, $file);
		$file 		= Path :: get('modules') . $module . DIRECTORY_SEPARATOR . Application :: get(['directory', 'translation']) . $file . $extension;
		$file 		= new File($file);
		$identifier = md5($file -> entity() -> getBasepath());
		$cache 		= new File(Path :: get('cache-translation') . $identifier);

		if(false === $file -> exists() && false === $source instanceof Viewmodel) {
			return trigger_error(sprintf('Translation file "%s" used in %s() does not exists', $file -> entity() -> getBasepath(), __METHOD__), E_USER_ERROR);
		}

		static :: cache($cache, $file);

		return $identifier;
	}
public static function load ( $ source ) { if ( false === is_string ( $ source ) && false === $ source instanceof Viewmodel ) { return trigger_error ( sprintf ( 'Argument 1 passed to %s() must be of the type string or instance of sFire\MVC\Viewmodel, "%s" given' , __METHOD__ , gettype ( $ source ) ) , E_USER_ERROR ) ; } $ file = $ source ; if ( $ source instanceof Viewmodel ) { $ path = Path :: get ( 'modules' ) . Router :: getRoute ( ) -> getModule ( ) . DIRECTORY_SEPARATOR ; $ views = $ path . Application :: get ( [ 'directory' , 'view' ] ) ; $ translations = $ path . Application :: get ( [ 'directory' , 'translation' ] ) ; $ extension = Application :: get ( [ 'extensions' , 'view' ] ) ; $ file = preg_replace ( '#^' . preg_quote ( $ views ) . '#' , '' , $ source -> getFile ( ) ) ; $ file = preg_replace ( '#' . preg_quote ( $ extension ) . '$#' , '' , $ file ) ; } $ module = Router :: getRoute ( ) -> getModule ( ) ; $ extension = Application :: get ( [ 'extensions' , 'translation' ] ) ; $ file = str_replace ( '.' , DIRECTORY_SEPARATOR , $ file ) ; $ file = Path :: get ( 'modules' ) . $ module . DIRECTORY_SEPARATOR . Application :: get ( [ 'directory' , 'translation' ] ) . $ file . $ extension ; $ file = new File ( $ file ) ; $ identifier = md5 ( $ file -> entity ( ) -> getBasepath ( ) ) ; $ cache = new File ( Path :: get ( 'cache-translation' ) . $ identifier ) ; if ( false === $ file -> exists ( ) && false === $ source instanceof Viewmodel ) { return trigger_error ( sprintf ( 'Translation file "%s" used in %s() does not exists' , $ file -> entity ( ) -> getBasepath ( ) , __METHOD__ ) , E_USER_ERROR ) ; } static :: cache ( $ cache , $ file ) ; return $ identifier ; }
Loads a new translation file
@param string|sFire\MVC\Viewmodel $source
@return string
Loads a new translation file