本文整理汇总了PHP中WT_I18N::list_separator方法的典型用法代码示例。如果您正苦于以下问题:PHP WT_I18N::list_separator方法的具体用法?PHP WT_I18N::list_separator怎么用?PHP WT_I18N::list_separator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WT_I18N
的用法示例。
在下文中一共展示了WT_I18N::list_separator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
//.........这里部分代码省略.........
}
Zend_Locale::setCache(self::$cache);
Zend_Translate::setCache(self::$cache);
$installed_languages = self::installed_languages();
if (is_null($locale) || !array_key_exists($locale, $installed_languages)) {
// Automatic locale selection.
$locale = WT_Filter::get('lang');
if ($locale && array_key_exists($locale, $installed_languages)) {
// Requested in the URL?
if (Auth::id()) {
Auth::user()->setSetting('language', $locale);
}
} elseif (array_key_exists($WT_SESSION->locale, $installed_languages)) {
// Rembered from a previous visit?
$locale = $WT_SESSION->locale;
} else {
// Browser preference takes priority over gedcom default
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$prefs = explode(',', str_replace(' ', '', $_SERVER['HTTP_ACCEPT_LANGUAGE']));
} else {
$prefs = array();
}
if (WT_GED_ID) {
// Add the tree’s default language as a low-priority
$locale = get_gedcom_setting(WT_GED_ID, 'LANGUAGE');
$prefs[] = $locale . ';q=0.2';
}
$prefs2 = array();
foreach ($prefs as $pref) {
list($l, $q) = explode(';q=', $pref . ';q=1.0');
$l = preg_replace_callback('/_[a-z][a-z]$/', function ($x) {
return strtoupper($x[0]);
}, str_replace('-', '_', $l));
// en-gb => en_GB
if (array_key_exists($l, $prefs2)) {
$prefs2[$l] = max((double) $q, $prefs2[$l]);
} else {
$prefs2[$l] = (double) $q;
}
}
// Ensure there is a fallback.
if (!array_key_exists('en_US', $prefs2)) {
$prefs2['en_US'] = 0.01;
}
arsort($prefs2);
foreach (array_keys($prefs2) as $pref) {
if (array_key_exists($pref, $installed_languages)) {
$locale = $pref;
break;
}
}
}
}
// Load the translation file
self::$translation_adapter = new Zend_Translate('gettext', WT_ROOT . 'language/' . $locale . '.mo', $locale);
// Deprecated - some custom modules use this to add translations
Zend_Registry::set('Zend_Translate', self::$translation_adapter);
// Load any local user translations
if (is_dir(WT_DATA_DIR . 'language')) {
if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.mo')) {
self::addTranslation(new Zend_Translate('gettext', WT_DATA_DIR . 'language/' . $locale . '.mo', $locale));
}
if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.php')) {
self::addTranslation(new Zend_Translate('array', WT_DATA_DIR . 'language/' . $locale . '.php', $locale));
}
if (file_exists(WT_DATA_DIR . 'language/' . $locale . '.csv')) {
self::addTranslation(new Zend_Translate('csv', WT_DATA_DIR . 'language/' . $locale . '.csv', $locale));
}
}
// Extract language settings from the translation file
global $DATE_FORMAT;
// I18N: This is the format string for full dates. See http://php.net/date for codes
$DATE_FORMAT = self::noop('%j %F %Y');
global $TIME_FORMAT;
// I18N: This is the format string for the time-of-day. See http://php.net/date for codes
$TIME_FORMAT = self::noop('%H:%i:%s');
// Alphabetic sorting sequence (upper-case letters), used by webtrees to sort strings
list(, self::$alphabet_upper) = explode('=', self::noop('ALPHABET_upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ'));
// Alphabetic sorting sequence (lower-case letters), used by webtrees to sort strings
list(, self::$alphabet_lower) = explode('=', self::noop('ALPHABET_lower=abcdefghijklmnopqrstuvwxyz'));
global $WEEK_START;
// I18N: This is the first day of the week on calendars. 0=Sunday, 1=Monday...
list(, $WEEK_START) = explode('=', self::noop('WEEK_START=0'));
global $TEXT_DIRECTION;
$TEXT_DIRECTION = self::scriptDirection(self::languageScript($locale));
self::$locale = $locale;
self::$dir = $TEXT_DIRECTION;
// I18N: This punctuation is used to separate lists of items.
self::$list_separator = self::translate(', ');
// I18N: This is the name of the MySQL collation that applies to your language. A list is available at http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html
self::$collation = self::translate('utf8_unicode_ci');
// Non-latin numbers may require non-latin digits
try {
self::$numbering_system = Zend_Locale_Data::getContent($locale, 'defaultnumberingsystem');
} catch (Zend_Locale_Exception $ex) {
// The latest CLDR database omits some languges such as Tatar (tt)
self::$numbering_system = 'latin';
}
return $locale;
}