当前位置: 首页>>代码示例>>PHP>>正文


PHP I18N::activeLocales方法代码示例

本文整理汇总了PHP中Fisharebest\Webtrees\I18N::activeLocales方法的典型用法代码示例。如果您正苦于以下问题:PHP I18N::activeLocales方法的具体用法?PHP I18N::activeLocales怎么用?PHP I18N::activeLocales使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Fisharebest\Webtrees\I18N的用法示例。


在下文中一共展示了I18N::activeLocales方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: commonCountriesList

 /**
  * A list of common countries.
  *
  * @return string
  */
 public function commonCountriesList()
 {
     $countries = $this->statsPlaces();
     if (empty($countries)) {
         return '';
     }
     $top10 = array();
     $i = 1;
     // Get the country names for each language
     $country_names = array();
     foreach (I18N::activeLocales() as $locale) {
         I18N::init($locale->languageTag());
         $all_countries = $this->getAllCountries();
         foreach ($all_countries as $country_code => $country_name) {
             $country_names[$country_name] = $country_code;
         }
     }
     I18N::init(WT_LOCALE);
     $all_db_countries = array();
     foreach ($countries as $place) {
         $country = trim($place['country']);
         if (array_key_exists($country, $country_names)) {
             if (!isset($all_db_countries[$country_names[$country]][$country])) {
                 $all_db_countries[$country_names[$country]][$country] = (int) $place['tot'];
             } else {
                 $all_db_countries[$country_names[$country]][$country] += (int) $place['tot'];
             }
         }
     }
     // get all the user’s countries names
     $all_countries = $this->getAllCountries();
     foreach ($all_db_countries as $country_code => $country) {
         $top10[] = '<li>';
         foreach ($country as $country_name => $tot) {
             $tmp = new Place($country_name, $this->tree);
             $place = '<a href="' . $tmp->getURL() . '" class="list_item">' . $all_countries[$country_code] . '</a>';
             $top10[] .= $place . ' - ' . I18N::number($tot);
         }
         $top10[] .= '</li>';
         if ($i++ == 10) {
             break;
         }
     }
     $top10 = implode('', $top10);
     return '<ul>' . $top10 . '</ul>';
 }
开发者ID:AlexSnet,项目名称:webtrees,代码行数:51,代码来源:Stats.php

示例2: header

        header('Location: ' . WT_BASE_URL . 'admin.php');
        return;
    case 'languages':
        if (Filter::checkCsrf()) {
            Site::setPreference('LANGUAGES', implode(',', Filter::postArray('LANGUAGES')));
            FlashMessages::addMessage(I18N::translate('The website preferences have been updated.'), 'success');
        }
        header('Location: ' . WT_BASE_URL . 'admin.php');
        return;
}
// Lists of options for <select> controls.
$SMTP_SSL_OPTIONS = array('none' => I18N::translate('none'), 'ssl' => I18N::translate('ssl'), 'tls' => I18N::translate('tls'));
$SMTP_ACTIVE_OPTIONS = array('internal' => I18N::translate('Use PHP mail to send messages'), 'external' => I18N::translate('Use SMTP to send messages'));
$WELCOME_TEXT_AUTH_MODE_OPTIONS = array(0 => I18N::translate('No predefined text'), 1 => I18N::translate('Predefined text that states all users can request a user account'), 2 => I18N::translate('Predefined text that states admin will decide on each request for a user account'), 3 => I18N::translate('Predefined text that states only family members can request a user account'), 4 => I18N::translate('Choose user defined welcome text typed below'));
$language_tags = array();
foreach (I18N::activeLocales() as $active_locale) {
    $language_tags[] = $active_locale->languageTag();
}
switch (Filter::get('action')) {
    case 'site':
        $controller->setPageTitle(I18N::translate('Website preferences'));
        break;
    case 'email':
        $controller->setPageTitle(I18N::translate('Sending email'));
        break;
    case 'login':
        $controller->setPageTitle(I18N::translate('Login and registration'));
        break;
    case 'tracking':
        $controller->setPageTitle(I18N::translate('Tracking and analytics'));
        break;
开发者ID:AlexSnet,项目名称:webtrees,代码行数:31,代码来源:admin_site_config.php

示例3: edit


//.........这里部分代码省略.........
            echo webtrees\I18N::translate('Content');
            ?>
					</label>
					<div class="col-sm-9">
						<textarea
							class="form-control html-edit"
							id="pages_content"
							rows="10"
							cols="90"
							name="pages_content"
							required
							type="text">
								<?php 
            echo webtrees\Filter::escapeHtml($items_content);
            ?>
						</textarea>
					</div>
				</div>
				
				<h3><?php 
            echo webtrees\I18N::translate('Languages');
            ?>
</h3>
				
				<div class="form-group">
					<label class="control-label col-sm-3" for="lang_*">
						<?php 
            echo webtrees\I18N::translate('Show this page for which languages?');
            ?>
					</label>
					<div class="col-sm-9">
						<?php 
            $accepted_languages = explode(',', $this->getBlockSetting($block_id, 'languages'));
            foreach (webtrees\I18N::activeLocales() as $locale) {
                ?>
								<div class="checkbox">
									<label title="<?php 
                echo $locale->languageTag();
                ?>
">
										<input type="checkbox" name="lang_<?php 
                echo $locale->languageTag();
                ?>
" <?php 
                echo in_array($locale->languageTag(), $accepted_languages) ? 'checked' : '';
                ?>
 ><?php 
                echo $locale->endonym();
                ?>
									</label>
								</div>
						<?php 
            }
            ?>
					</div>
				</div>
				
				<h3><?php 
            echo webtrees\I18N::translate('Visibility and Access');
            ?>
</h3>
				
				<div class="form-group">
					<label class="control-label col-sm-3" for="block_order">
						<?php 
            echo webtrees\I18N::translate('Page position');
开发者ID:jpretired,项目名称:jp-webtrees,代码行数:67,代码来源:module.php

示例4: menuLanguages

 /**
  * A menu to show a list of available languages.
  *
  * @return Menu|null
  */
 protected function menuLanguages()
 {
     $menu = new Menu(I18N::translate('Language'), '#', 'menu-language');
     foreach (I18N::activeLocales() as $locale) {
         $language_tag = $locale->languageTag();
         $class = 'menu-language-' . $language_tag . (WT_LOCALE === $language_tag ? ' active' : '');
         $menu->addSubmenu(new Menu($locale->endonym(), '#', $class, array('onclick' => 'return false;', 'data-language' => $language_tag)));
     }
     if (count($menu->getSubmenus()) > 1) {
         return $menu;
     } else {
         return null;
     }
 }
开发者ID:tronsmit,项目名称:webtrees,代码行数:19,代码来源:AbstractTheme.php

示例5: editFieldLanguage

 /**
  * Print an edit control for a language field.
  *
  * @param string $name
  * @param string $selected
  * @param string $extra
  *
  * @return string
  */
 public static function editFieldLanguage($name, $selected = '', $extra = '')
 {
     $languages = array();
     foreach (I18N::activeLocales() as $locale) {
         $languages[$locale->languageTag()] = $locale->endonym();
     }
     return self::selectEditControl($name, $languages, null, $selected, $extra);
 }
开发者ID:josefpavlik,项目名称:webtrees,代码行数:17,代码来源:FunctionsEdit.php


注:本文中的Fisharebest\Webtrees\I18N::activeLocales方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。