public static function set_defaults() { if (isset(self::$languagesCFG['default_prefix'])) { // LOOP BUSCADOR foreach (self::$languagesCFG['dictionaries'] as $lang) { if ($lang['prefix'] == self::$languagesCFG['default_prefix']) { $def = $lang; } } // VALIDATES IF DEFAULT LANGUAGE IS FOUND if (empty($def)) { die('$languagesCFG[default_prefix] Default dictionary missmatch!'); } // SETS DEFAULT LANGUAGE self::$selectedLang = $def; } else { die('$languagesCFG[default_prefix] NOT SET, DISABLE $languagesCFG[allow_translations]'); } }
/** * _load_translations * * Carga las traducciones cuando sean requeridas, si no, continúa sin problemas. * * @author Adrián Méndez <*****@*****.**> * @Version 1.0 * @Date 10/08/2015 */ private function _load_translations() { if (!isset(AppConfig::$languagesCFG) or !AppConfig::$languagesCFG['allow_translations']) { // LOADS TRANSLATION CLASS $filename = self::path(null, array('Lib')) . 'Untranslate.inc.php'; } else { // LOADS TRANSLATION CLASS $filename = self::path(null, array('Lib')) . 'Translate.inc.php'; } // LOADS STATIC TRANSLATOR if (file_exists($filename)) { include_once $filename; if (class_exists('Translate')) { // VERIFICA QUE LA CONFIGURACIÓN DE LENGUAJE POR LO MENOS TENGA EL LENGUAJE POR DEFECTO DE APPCONFIG if (is_null(self::$language)) { Translate::set_defaults(); } else { Translate::$selectedLang = self::$language; } // FETCH TRANSLATIONS Translate::load_translations(); } } else { die('Error cargando Core/LIB/Translate.inc.php'); } }