예제 #1
0
 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]');
     }
 }
예제 #2
0
파일: APP.inc.php 프로젝트: Bincat/MVC
 /**
  * _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');
     }
 }