function plugin___inline() { global $language_considering_setting_level; global $language; global $i18n_temp_msg; switch (func_num_args()) { case 1: list($msg) = func_get_args(); // $parm_lang = DEFAULT_LANG; $parm_lang = 'en_US'; break; default: list($parm_lang, $msg) = func_get_args(); } $msg = strip_htmltag($msg); // FIXME: level 5 $view_lang = $language_considering_setting_level == 0 ? Lang::getLanguage(5) : $language; $view_lang_split = AcceptLanguage::splitLocaleStr($view_lang); // ja_JP なら ja に分割 if ($parm_lang == $view_lang || $parm_lang == $view_lang_split[1]) { return $msg; } // 指定言語と同じ // 指定文字列が en 以外の場合は、ベース言語に変換後、他言語に変換する $parm_lang_split = AcceptLanguage::splitLocaleStr($parm_lang); if (isset($i18n_temp_msg)) { $temp_msg = i18n_TempMsg($parm_lang_split, $view_lang_split, $msg); if (!empty($temp_msg)) { return $temp_msg; } } if ($parm_lang_split[1] !== 'en') { $msg = i18n_ConfMsgGet($parm_lang_split, $msg, 1); } // :config から、単語を検索 return i18n_ConfMsgGet($view_lang_split, $msg); }
function plugin_multilang_accept($lang) { global $language_considering_setting_level; global $language; // FIXME: level 5 $env = $language_considering_setting_level == 0 ? Lang::getLanguage(5) : $language; $l = AcceptLanguage::splitLocaleStr($env); return $lang == $env || $lang == $l[1]; }
if ( class_exists('dba') ){ $cache_adapter = 'Dba'; }else if ( class_exists('apc') && ini_get('apc.enabled') ){ $cache_adapter = 'Apc'; }else if ( class_exists('Memcached') ){ $cache_adapter = 'Memcached'; } } */ // キャッシュ $cache = array('core' => StorageFactory::factory(array('adapter' => array('name' => $cache_adapter, 'options' => array('namespace' => $cache_adapter === 'Filesystem' ? null : PKWK_WIKI_NAMESPACE, 'cache_dir' => $cache_adapter === 'Filesystem' ? SITE_HOME . 'cache/' : null)), 'plugins' => array($cache_adapter === 'Filesystem' ? 'serializer' : null))), 'wiki' => StorageFactory::factory(array('adapter' => array('name' => $cache_adapter, 'options' => array('ttl' => 86400, 'namespace' => $cache_adapter === 'Filesystem' ? null : PKWK_WIKI_NAMESPACE, 'cache_dir' => $cache_adapter === 'Filesystem' ? CACHE_DIR : null)), 'plugins' => array($cache_adapter === 'Filesystem' ? 'serializer' : null))), 'raw' => StorageFactory::factory(array('adapter' => array('name' => 'Filesystem', 'options' => array('namespace' => 'raw', 'cache_dir' => CACHE_DIR))))); $info[] = 'Cache system using <var>' . $cache_adapter . '</var>.'; ///////////////////////////////////////////////// // 他言語化設定 // Lang::setLanguage(); Time::init(); $translator = new Translator(); $translator->factory(array('locale' => Lang::$language_prepared, 'cache' => $cache['core'])); T_setlocale(LC_ALL, PO_LANG); T_bindtextdomain(DOMAIN, LANG_DIR); T_textdomain(DOMAIN); ///////////////////////////////////////////////// // リソースファイルの読み込み require LIB_DIR . 'resource.php'; // Init encoding hint define('PKWK_ENCODING_HINT', isset($_LANG['encode_hint']) && $_LANG['encode_hint'] !== 'encode_hint' ? $_LANG['encode_hint'] : 'ぷ'); ///////////////////////////////////////////////// // INI_FILE: Init $script if (isset($script)) { Router::get_script_uri($script);