X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fpgettext.php;h=f6f26a8cc4a13b90f8daea14b1ca664f6c8e2f10;hb=2b161108fe6552ef2effb7b300553f0242b2e49e;hp=79b341c0da4986b735a68b1bbeee25c7d3d04346;hpb=9c2c4839968169a191084d6d2b0d629d82430e67;p=friendica.git diff --git a/include/pgettext.php b/include/pgettext.php index 79b341c0da..f6f26a8cc4 100644 --- a/include/pgettext.php +++ b/include/pgettext.php @@ -10,9 +10,9 @@ * */ -use \Friendica\Core\Config; +use Friendica\Core\Config; -require_once("include/dba.php"); +require_once "include/dba.php"; if (! function_exists('get_browser_language')) { /** @@ -20,7 +20,7 @@ if (! function_exists('get_browser_language')) { */ function get_browser_language() { - if (x($_SERVER,'HTTP_ACCEPT_LANGUAGE')) { + if (x($_SERVER, 'HTTP_ACCEPT_LANGUAGE')) { // break up string into pieces (languages and q factors) preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $lang_parse); @@ -29,11 +29,11 @@ function get_browser_language() { if (count($lang_parse[1])) { // go through the list of prefered languages and add a generic language // for sub-linguas (e.g. de-ch will add de) if not already in array - for ($i=0; $i3 ) { + if (strlen($lang_parse[1][$i])>3 ) { $dashpos = strpos($lang_parse[1][$i], '-'); - if (! in_array(substr($lang_parse[1][$i], 0, $dashpos), $lang_list ) ) { + if (!in_array(substr($lang_parse[1][$i], 0, $dashpos), $lang_list ) ) { $lang_list[] = strtolower(substr($lang_parse[1][$i], 0, $dashpos)); } } @@ -42,9 +42,9 @@ function get_browser_language() { } // check if we have translations for the preferred languages and pick the 1st that has - for ($i=0; $ilangsave = $lang; - if ($language === $lang) + if ($language === $lang) { return; + } if (isset($a->strings) && count($a->strings)) { $a->stringsave = $a->strings; @@ -77,18 +78,19 @@ function push_lang($language) { function pop_lang() { global $lang, $a; - if ($lang === $a->langsave) + if ($lang === $a->langsave) { return; + } - if (isset($a->stringsave)) + if (isset($a->stringsave)) { $a->strings = $a->stringsave; - else + } else { $a->strings = array(); + } $lang = $a->langsave; } - // l if (! function_exists('load_translation_table')) {