diff --git a/php/config.inc.php b/php/config.inc.php index 8f69933..42c9658 100644 --- a/php/config.inc.php +++ b/php/config.inc.php @@ -45,7 +45,8 @@ // Deprecated: Modify through admin -> config in web interface. //define('ZOPH_TITLE', "Zoph"); - define('LANG_DIR', "lang"); // where language files are stored + // deprecated + //define('LANG_DIR', "lang"); // where language files are stored # Use this language when neither user or browser specify a language define('DEFAULT_LANG', 'en'); diff --git a/php/translation.inc.php b/php/translation.inc.php index 2395847..acb1cf0 100644 --- a/php/translation.inc.php +++ b/php/translation.inc.php @@ -22,7 +22,7 @@ */ /** - * This class contains a set of translations read from a file in the LANG_DIR + * This class contains a set of translations read from a file in the self::LANG_DIR * directory. * These files have the following format * # Zoph Language File - @@ -44,6 +44,8 @@ class language { public static $base="en"; public static $base_name="English"; + const LANG_DIR="lang"; + /** * @param string iso ISO definition of the language, usually 2 letters or * two letters dash two letters, for example nl en-ca. @@ -51,7 +53,7 @@ class language { */ function __construct($iso) { $this->name=$iso; - $this->filename=LANG_DIR. "/" . $iso; + $this->filename=self::LANG_DIR. "/" . $iso; $this->iso=strtolower($iso); } @@ -141,11 +143,11 @@ function translate($string, $error = true) { */ public static function get_all() { $langs=array(); - if(is_dir(LANG_DIR) && is_readable(LANG_DIR)) { - $handle=opendir(LANG_DIR); + if(is_dir(self::LANG_DIR) && is_readable(self::LANG_DIR)) { + $handle=opendir(self::LANG_DIR); while ($filename = trim(readdir($handle))) { - if(!is_dir(LANG_DIR . "/" . $filename)) { - if(is_readable(strtolower(LANG_DIR . "/" . $filename))) { + if(!is_dir(self::LANG_DIR . "/" . $filename)) { + if(is_readable(strtolower(self::LANG_DIR . "/" . $filename))) { # making filename lowercase, so we won't include # any capitalized filenames... Zoph will not able # to find them back later... @@ -180,7 +182,7 @@ public static function get_all() { * @return string null|iso */ public static function exists($iso) { - $file=LANG_DIR . '/' . $iso; + $file=self::LANG_DIR . '/' . $iso; if (file_exists($file) && is_file($file)) { return $iso; } else {