Parcourir la source

Enhancements to language support (for future use)

optimized the text.php to check the language code once, not every time
Matthew Vale il y a 9 ans
Parent
commit
1c12230026

+ 9 - 6
resources/classes/text.php

@@ -30,6 +30,8 @@ class text {
 	 * @var string $app_path		examples: app/exec or core/domains
 	 */
 	public function get($language_code = null, $app_path = null) {
+		//get the global app_languages.php
+			include $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/core/app_languages.php";
 		//get the app_languages.php
 			if ($app_path != null) {
 				include $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH."/".$app_path."/app_languages.php";
@@ -49,15 +51,16 @@ class text {
 			}
 			$_SESSION['app']['languages'] = array_unique($app_languages);
 
+		//check the session language
+			if(isset($_SESSION['domain'])){
+				$language_code = $_SESSION['domain']['language']['code'];
+			}elseif($language_code == null){
+				$language_code = 'en-us';
+			}
 		//reduce to specific language
 			if ($language_code != 'all') {
 				foreach($text as $key => $value) {
-					if ($language_code == null) {
-						$text[$key] = $value[$_SESSION['domain']['language']['code']];
-					}
-					else {
-						$text[$key] = $value[$language_code];
-					}
+					$text[$key] = $value[$language_code];
 				}
 			}
 

+ 1 - 1
resources/install.php

@@ -1745,7 +1745,7 @@ EOL;
 			$theme_dir = $_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes';
 			if ($handle = opendir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/themes')) {
 				while (false !== ($dir_name = readdir($handle))) {
-					if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && $dir_name != ".git" && is_readable($theme_dir.'/'.$dir_name)) {
+					if ($dir_name != "." && $dir_name != ".." && $dir_name != ".svn" && $dir_name != ".git" && $dir_name != "flags" && is_readable($theme_dir.'/'.$dir_name)) {
 						$dir_label = str_replace('_', ' ', $dir_name);
 						$dir_label = str_replace('-', ' ', $dir_label);
 						if ($dir_name == $install_template_name) {

BIN
themes/flags/ar-eg.png


BIN
themes/flags/de-at.png


BIN
themes/flags/en-us.png


BIN
themes/flags/es-cl.png


BIN
themes/flags/fr-fr.png


BIN
themes/flags/nl-nl.png


BIN
themes/flags/pl.png


BIN
themes/flags/pt-br.png


BIN
themes/flags/pt-pt.png


BIN
themes/flags/sv-se.png


BIN
themes/flags/uk.png