diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-05-24 13:45:03 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-05-24 13:45:03 +0000 |
commit | 88491806c38ef9c3f9bde06e3c6ac7e0244a5a3c (patch) | |
tree | ce0ce317ae2899eea060a4dc0c3c0f25669f64e9 /langs.inc.php | |
parent | f07a4ca4e2e48553660fbed9ddf6a5f2cd586cf8 (diff) | |
download | www-88491806c38ef9c3f9bde06e3c6ac7e0244a5a3c.tar www-88491806c38ef9c3f9bde06e3c6ac7e0244a5a3c.tar.gz www-88491806c38ef9c3f9bde06e3c6ac7e0244a5a3c.tar.bz2 www-88491806c38ef9c3f9bde06e3c6ac7e0244a5a3c.tar.xz www-88491806c38ef9c3f9bde06e3c6ac7e0244a5a3c.zip |
new, _lang_return() function
Diffstat (limited to 'langs.inc.php')
-rw-r--r-- | langs.inc.php | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/langs.inc.php b/langs.inc.php index 23103f051..6d6d2aa4e 100644 --- a/langs.inc.php +++ b/langs.inc.php @@ -182,6 +182,26 @@ function _h($s, $args = null, $tag = 'p') { } /** +*/ +function _lang_return($file) +{ + $strings = array(); + $f = file($file); + + foreach ($f as $k => $v) { + + $C = substr($v, 0, 1); + if ($C === '#') continue; + + if ($C === ';' && !empty($f[$k+1])) { + $strings[trim(substr($v, 1))] = trim($f[$k+1]); + } + } + + return $strings; +} + +/** * @param string $locale * @param string $domain * @@ -195,25 +215,15 @@ function _lang_load($locale, $domain) return true; $lang_file = sprintf('%s/langs/%s/%s.%s.lang', G_APP_ROOT, $locale, $domain, $locale); - if (file_exists($lang_file)) { global $_t; - $f = file($lang_file); + $_t = array_merge($_t, _lang_return($lang_file)); - foreach ($f as $k => $v) { - - $C = substr($v, 0, 1); - if ($C === '#') continue; - - if ($C === ';' && !empty($f[$k+1])) { - $_t[trim(substr($v, 1))] = trim($f[$k+1]); - } - } return true; } - error_log(sprintf('Could not find %s', $lang_file)); + return false; } |