lib/Skeleton/I18n/Translation.php
private function reload_po_file() {
		$po_files = [];
		$po_files[] = Config::$po_directory . '/' . $this->language->name_short . '/' . $this->application_name . '.po';
		$packages = \Skeleton\Core\Package::get_all();

		foreach ($packages as $package) {
			if (file_exists(Config::$po_directory . '/' . $this->language->name_short . '/package/' . $package->name . '.po')) {
				$po_files[] = Config::$po_directory . '/' . $this->language->name_short . '/package/' . $package->name . '.po';
			}
		}

		$array_modified = 0;
		if (file_exists(Config::$cache_directory . '/' . $this->language->name_short . '/' . $this->application_name . '.php')) {
			$array_modified = filemtime(Config::$cache_directory . '/' . $this->language->name_short . '/' . $this->application_name . '.php');
		}

		$po_file_modified = null;
		foreach ($po_files as $po_file) {
			if (!file_exists($po_file)) {
				continue;
			}
			if ($po_file_modified === null) {
				$po_file_modified = filemtime($po_file);
			}
			if (filemtime($po_file) > $po_file_modified) {
				$po_file_modified = filemtime($po_file);
			}
		}

		if ($array_modified >= $po_file_modified) {
			return;
		}

		$po_strings = [];
		foreach (array_reverse($po_files) as $po_file) {
			$strings = Util::load($po_file);
			foreach ($strings as $key => $value) {
				if (!isset($po_strings[$key])) {
					$po_strings[$key] = $value;
				} elseif ($value != '') {
					$po_strings[$key] = $value;
				} else {
					continue;
				}
			}
		}

		if (!file_exists(Config::$cache_directory . '/' . $this->language->name_short)) {
			mkdir(Config::$cache_directory . '/' . $this->language->name_short, 0755, true);
		}

		file_put_contents(Config::$cache_directory . '/' . $this->language->name_short . '/' . $this->application_name . '.php', '<?php $strings = ' . var_export($po_strings, true) . ';');
	}
private function reload_po_file() {
		$po_files = [];
		$po_files[] = Config::$po_directory . '/' . $this->language->name_short . '/' . $this->application_name . '.po';
		$packages = \Skeleton\Core\Package::get_all();

		foreach ($packages as $package) {
			if (file_exists(Config::$po_directory . '/' . $this->language->name_short . '/package/' . $package->name . '.po')) {
				$po_files[] = Config::$po_directory . '/' . $this->language->name_short . '/package/' . $package->name . '.po';
			}
		}

		$array_modified = 0;
		if (file_exists(Config::$cache_directory . '/' . $this->language->name_short . '/' . $this->application_name . '.php')) {
			$array_modified = filemtime(Config::$cache_directory . '/' . $this->language->name_short . '/' . $this->application_name . '.php');
		}

		$po_file_modified = null;
		foreach ($po_files as $po_file) {
			if (!file_exists($po_file)) {
				continue;
			}
			if ($po_file_modified === null) {
				$po_file_modified = filemtime($po_file);
			}
			if (filemtime($po_file) > $po_file_modified) {
				$po_file_modified = filemtime($po_file);
			}
		}

		if ($array_modified >= $po_file_modified) {
			return;
		}

		$po_strings = [];
		foreach (array_reverse($po_files) as $po_file) {
			$strings = Util::load($po_file);
			foreach ($strings as $key => $value) {
				if (!isset($po_strings[$key])) {
					$po_strings[$key] = $value;
				} elseif ($value != '') {
					$po_strings[$key] = $value;
				} else {
					continue;
				}
			}
		}

		if (!file_exists(Config::$cache_directory . '/' . $this->language->name_short)) {
			mkdir(Config::$cache_directory . '/' . $this->language->name_short, 0755, true);
		}

		file_put_contents(Config::$cache_directory . '/' . $this->language->name_short . '/' . $this->application_name . '.php', '<?php $strings = ' . var_export($po_strings, true) . ';');
	}
private function reload_po_file ( ) { $ po_files = [ ] ; $ po_files [ ] = Config :: $ po_directory . '/' . $ this -> language -> name_short . '/' . $ this -> application_name . '.po' ; $ packages = \ Skeleton \ Core \ Package :: get_all ( ) ; foreach ( $ packages as $ package ) { if ( file_exists ( Config :: $ po_directory . '/' . $ this -> language -> name_short . '/package/' . $ package -> name . '.po' ) ) { $ po_files [ ] = Config :: $ po_directory . '/' . $ this -> language -> name_short . '/package/' . $ package -> name . '.po' ; } } $ array_modified = 0 ; if ( file_exists ( Config :: $ cache_directory . '/' . $ this -> language -> name_short . '/' . $ this -> application_name . '.php' ) ) { $ array_modified = filemtime ( Config :: $ cache_directory . '/' . $ this -> language -> name_short . '/' . $ this -> application_name . '.php' ) ; } $ po_file_modified = null ; foreach ( $ po_files as $ po_file ) { if ( ! file_exists ( $ po_file ) ) { continue ; } if ( $ po_file_modified === null ) { $ po_file_modified = filemtime ( $ po_file ) ; } if ( filemtime ( $ po_file ) > $ po_file_modified ) { $ po_file_modified = filemtime ( $ po_file ) ; } } if ( $ array_modified >= $ po_file_modified ) { return ; } $ po_strings = [ ] ; foreach ( array_reverse ( $ po_files ) as $ po_file ) { $ strings = Util :: load ( $ po_file ) ; foreach ( $ strings as $ key => $ value ) { if ( ! isset ( $ po_strings [ $ key ] ) ) { $ po_strings [ $ key ] = $ value ; } elseif ( $ value != '' ) { $ po_strings [ $ key ] = $ value ; } else { continue ; } } } if ( ! file_exists ( Config :: $ cache_directory . '/' . $ this -> language -> name_short ) ) { mkdir ( Config :: $ cache_directory . '/' . $ this -> language -> name_short , 0755 , true ) ; } file_put_contents ( Config :: $ cache_directory . '/' . $ this -> language -> name_short . '/' . $ this -> application_name . '.php' , '<?php $strings = ' . var_export ( $ po_strings , true ) . ';' ) ; }
Read the po files

@access public
Read the po files