From 10ed334e8c81d1db4a506716b78ece13dc69266c Mon Sep 17 00:00:00 2001 From: redmatrix Date: Sun, 17 Jan 2016 16:29:32 -0800 Subject: various issues from the forums --- include/language.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/language.php') diff --git a/include/language.php b/include/language.php index 59979aa85..cea31924c 100644 --- a/include/language.php +++ b/include/language.php @@ -182,7 +182,7 @@ function t($s, $ctx = '') { function translate_projectname($s) { - return str_replace(array('$projectname','$Projectname'),array(PLATFORM_NAME,ucfirst(PLATFORM_NAME)),$s); + return str_replace(array('$projectname','$Projectname'),array(get_platform_name(),ucfirst(get_platform_name())),$s); } -- cgit v1.2.3 From bb381daae3b6bf8d230fd0c846a815689e0ff723 Mon Sep 17 00:00:00 2001 From: redmatrix Date: Mon, 15 Feb 2016 20:32:42 -0800 Subject: update fr strings from transifex --- include/language.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'include/language.php') diff --git a/include/language.php b/include/language.php index cea31924c..c843db85e 100644 --- a/include/language.php +++ b/include/language.php @@ -65,15 +65,22 @@ function get_best_language() { if(isset($langs) && count($langs)) { foreach ($langs as $lang => $v) { $lang = strtolower($lang); - if(file_exists("view/$lang") && is_dir("view/$lang")) { + if(is_dir("view/$lang")) { $preferred = $lang; break; } } } - if(isset($preferred)) - return $preferred; + if(! isset($preferred)) + $preferred = 'unset'; + + $arr = array('langs' => $langs, 'preferred' => $preferred); + + call_hooks('get_best_language',$arr); + + if($arr['preferred'] !== 'unset') + return $arr['preferred']; $a = get_app(); return ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en'); -- cgit v1.2.3 From 342fda94e4162634eeb67c18c1d284e7d78f217f Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 18 Feb 2016 15:24:58 -0800 Subject: Provide Zotlabs\Project and System class for querying details about the project/version info. Move these out of /boot.php --- include/language.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/language.php') diff --git a/include/language.php b/include/language.php index c843db85e..121816ae6 100644 --- a/include/language.php +++ b/include/language.php @@ -189,7 +189,7 @@ function t($s, $ctx = '') { function translate_projectname($s) { - return str_replace(array('$projectname','$Projectname'),array(get_platform_name(),ucfirst(get_platform_name())),$s); + return str_replace(array('$projectname','$Projectname'),array(Zotlabs\Project\System::get_platform_name(),ucfirst(Zotlabs\Project\System::get_platform_name())),$s); } -- cgit v1.2.3 From 9abd95fad3784a10fc48bc40f9b8a75d7d74edda Mon Sep 17 00:00:00 2001 From: redmatrix Date: Thu, 31 Mar 2016 16:06:03 -0700 Subject: static App --- include/language.php | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'include/language.php') diff --git a/include/language.php b/include/language.php index 121816ae6..1a012cb84 100644 --- a/include/language.php +++ b/include/language.php @@ -83,38 +83,38 @@ function get_best_language() { return $arr['preferred']; $a = get_app(); - return ((isset($a->config['system']['language'])) ? $a->config['system']['language'] : 'en'); + return ((isset(App::$config['system']['language'])) ? App::$config['system']['language'] : 'en'); } function push_lang($language) { global $a; - $a->langsave = $a->language; + App::$langsave = App::$language; - if($language === $a->language) + if($language === App::$language) return; - if(isset($a->strings) && count($a->strings)) { - $a->stringsave = $a->strings; + if(isset(App::$strings) && count(App::$strings)) { + App::$stringsave = App::$strings; } - $a->strings = array(); + App::$strings = array(); load_translation_table($language); - $a->language = $language; + App::$language = $language; } function pop_lang() { global $a; - if($a->language === $a->langsave) + if(App::$language === App::$langsave) return; - if(isset($a->stringsave)) - $a->strings = $a->stringsave; + if(isset(App::$stringsave)) + App::$strings = App::$stringsave; else - $a->strings = array(); + App::$strings = array(); - $a->language = $a->langsave; + App::$language = App::$langsave; } /** @@ -126,7 +126,7 @@ function pop_lang() { function load_translation_table($lang, $install = false) { global $a; - $a->strings = array(); + App::$strings = array(); if(file_exists("view/$lang/hstrings.php")) { include("view/$lang/hstrings.php"); @@ -173,8 +173,8 @@ function t($s, $ctx = '') { global $a; $cs = $ctx ? '__ctx:' . $ctx . '__ ' . $s : $s; - if (x($a->strings, $cs)) { - $t = $a->strings[$cs]; + if (x(App::$strings, $cs)) { + $t = App::$strings[$cs]; return ((is_array($t)) ? translate_projectname($t[0]) : translate_projectname($t)); } @@ -208,9 +208,9 @@ function tt($singular, $plural, $count, $ctx = ''){ $a = get_app(); $cs = $ctx ? "__ctx:" . $ctx . "__ " . $singular : $singular; - if (x($a->strings,$cs)) { - $t = $a->strings[$cs]; - $f = 'string_plural_select_' . str_replace('-', '_', $a->language); + if (x(App::$strings,$cs)) { + $t = App::$strings[$cs]; + $f = 'string_plural_select_' . str_replace('-', '_', App::$language); if (! function_exists($f)) $f = 'string_plural_select_default'; -- cgit v1.2.3 From 54aa998b520f0f8932be3f5e358b926fadd1b77a Mon Sep 17 00:00:00 2001 From: redmatrix Date: Tue, 5 Apr 2016 22:13:56 -0700 Subject: undeclared static property App::$stringsave (push_lang() and pop_lang()) --- include/language.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/language.php') diff --git a/include/language.php b/include/language.php index 1a012cb84..d6b7606ca 100644 --- a/include/language.php +++ b/include/language.php @@ -109,7 +109,7 @@ function pop_lang() { if(App::$language === App::$langsave) return; - if(isset(App::$stringsave)) + if(isset(App::$stringsave) && is_array(App::$stringsave)) App::$strings = App::$stringsave; else App::$strings = array(); -- cgit v1.2.3