Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
lang.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5  * @package FDL
6 */
7 /**
8  * Locale name and language name localization
9  *
10  * @author Anakeen 2009
11  * @version $Id: lang.php,v 1.5 2009/01/16 13:33:00 jerome Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage
15  */
16 /**
17  */
18 
19 $lang_dir = DEFAULT_PUBDIR . "/locale";
20 
21 $lang = array();
23 if ($ret === false) {
24  error_log(__FILE__ . sprintf(" Error loading lang from '%s'", $lang_dir));
25  return false;
26 }
27 
28 if (count($lang) <= 0) {
29  error_log(sprintf(__FILE__ . " Language config is empty!"));
30  return false;
31 }
32 
33 foreach ($lang as $k => $v) {
34  if (file_exists(DEFAULT_PUBDIR . "/locale/" . $v["locale"])) {
35  if (!isset($v["flag"]) || $v["flag"] == "") $lang[$k]["flag"] = $k . ".png";
36  }
37 }
38 
40 {
41  $dir_fh = @opendir($lang_dir);
42  if ($dir_fh === false) {
43  error_log(sprintf(__FILE__ . " Could not open lang directory '%s'", $lang_dir));
44  return false;
45  }
46 
47  while ($subdir = readdir($dir_fh)) {
48  $dir = $lang_dir . DIRECTORY_SEPARATOR . $subdir;
49 
50  if ($dir == '.' || $dir == '..' || !is_dir($dir)) {
51  continue;
52  }
53 
54  if (is_file("$dir/lang.php")) {
55  $ret = load_lang_php($lang, "$dir/lang.php");
56  if (!$ret) {
57  error_log(sprintf(__FILE__ . " Error loading lang.php '%s/%s'", $dir, "lang.php"));
58  continue;
59  }
60  }
61  }
62 
63  return true;
64 }
65 
67 {
68  $ret = include_once ($file);
69  return $ret;
70 }
71 ?>
← centre documentaire © anakeen - published under CC License - Dynacase