/** * 实际加载翻译文件的接口 * * @see \HuiLib\Lang\LangBase::loadLang() */ public function loadLang($locale) { parent::loadLang($locale); $filePath = $this->localPath . $locale . self::FILE_EXT; $this->iniDriver[$locale] = new ConfigBase($filePath); return $this; }
/** * 实际加载翻译文件的接口 * * @see \HuiLib\Lang\LangBase::loadLang() */ public function loadLang($locale) { parent::loadLang($locale); $filePath = $this->localPath . $locale . self::FILE_EXT; $this->loadTranslationData($filePath, $locale); return $this; }
/** * 获取调用HuiLib库的翻译实例 * * 默认存在Lang/I18N目录下 */ public static function getHuiLibLang($lang = NULL) { $adapter = array('adapter' => 'gettext', 'path' => LIB_PATH . 'Lang' . SEP . 'I18N' . SEP, 'default' => self::DEFAULT_LOCALE); self::$huiLibInstance = self::create($adapter); if ($lang) { self::$huiLibInstance->loadLang($lang); } else { self::$huiLibInstance->loadLang($adapter['default']); } return self::$huiLibInstance; }