示例#1
0
<?php

return array('TAGLIB_BEGIN' => '{', 'TAGLIB_END' => '}', 'HTML_CACHE_ON' => FALSE, 'HTML_CACHE_TIME' => 10, 'TMPL_STRIP_SPACE' => TRUE, 'HTML_FILE_SUFFIX' => '.html', 'HTML_CACHE_RULES' => array('*' => array(auto_lang() . '/{:module}_{:controller}_{:action}_{id}')), 'URL_ROUTER_ON' => TRUE, 'URL_ROUTE_RULES' => array('avatar/:id' => 'member/avatar/id/:1_small', '/^new\\/(\\d+)$/' => 'Index/index?hehe=jeg_:1'), 'URL_MAP_RULES' => array('new/top' => 'index/index'));
示例#2
0
$app['language'] = $_SESSION[APPCONFIG]->getValue('appearance', 'language');
if ($app['language'] == 'auto') {
    # Make sure their browser correctly reports language. If not, skip this.
    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        # Get the languages which are spetcified in the HTTP header
        $app['lang_http'] = preg_split('/[;,]+/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
        foreach ($app['lang_http'] as $key => $value) {
            if (substr($value, 0, 2) == 'q=') {
                unset($app['lang_http'][$key]);
                continue;
            }
            $value = preg_split('/[-]+/', $value);
            if (sizeof($value) == 2) {
                $app['lang_http'][$key] = strtolower($value[0]) . '_' . strtoupper($value[1]);
            } else {
                $app['lang_http'][$key] = auto_lang(strtolower($value[0]));
            }
        }
        $app['lang_http'] = array_unique($app['lang_http']);
        foreach ($app['lang_http'] as $lang) {
            $app['language_dir'] = LANGDIR . $lang;
            if (substr($lang, 0, 2) == 'en' || file_exists($app['language_dir']) && is_readable($app['language_dir'])) {
                # Set language
                putenv('LANG=' . $lang);
                # e.g. LANG=de_DE
                $lang .= '.UTF-8';
                setlocale(LC_ALL, $lang);
                # set LC_ALL to de_DE
                bindtextdomain('messages', LANGDIR);
                bind_textdomain_codeset('messages', 'UTF-8');
                textdomain('messages');
示例#3
0
$language = $config->GetValue('appearance', 'language');
if ($language == 'auto') {
    # Make sure their browser correctly reports language. If not, skip this.
    if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
        # Get the languages which are spetcified in the HTTP header
        $HTTP_LANGS = preg_split('/[;,]+/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
        foreach ($HTTP_LANGS as $key => $value) {
            if (substr($value, 0, 2) == 'q=') {
                unset($HTTP_LANGS[$key]);
                continue;
            }
            $value = preg_split('/[-]+/', $value);
            if (sizeof($value) == 2) {
                $HTTP_LANGS[$key] = strtolower($value[0]) . '_' . strtoupper($value[1]);
            } else {
                $HTTP_LANGS[$key] = auto_lang(strtolower($value[0]));
            }
        }
        $HTTP_LANGS = array_unique($HTTP_LANGS);
        foreach ($HTTP_LANGS as $HTTP_LANG) {
            # Try to grab one after the other the language file
            $language_file = LANGDIR . $HTTP_LANG;
            if (substr($HTTP_LANG, 0, 2) == 'en' || file_exists($language_file) && is_readable($language_file)) {
                # Set language
                putenv('LANG=' . $HTTP_LANG);
                # e.g. LANG=de_DE
                setlocale(LC_ALL, $HTTP_LANG);
                # set LC_ALL to de_DE
                bindtextdomain('messages', LANGDIR);
                bind_textdomain_codeset('messages', 'UTF-8');
                textdomain('messages');