本文整理汇总了PHP中format_language函数的典型用法代码示例。如果您正苦于以下问题:PHP format_language函数的具体用法?PHP format_language怎么用?PHP format_language使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_language函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute($request)
{
// loop through application settings and extract enabled i18n languages
foreach (sfConfig::getAll() as $setting => $value) {
if (0 === strpos($setting, 'app_i18n_languages')) {
$enabledI18nLanguages[$value] = format_language($value, $value);
}
}
// sort languages by alpha code to look pretty
ksort($enabledI18nLanguages);
$this->enabledI18nLanguages = $enabledI18nLanguages;
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:12,代码来源:changeLanguageSelectboxComponent.class.php
示例2: format_language
<?php
echo format_language($schema_property_element_history->getLanguage());
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:3,代码来源:_language.php
示例3: __
?>
</ul>
</td>
<td class="details_lang">
<h3><?php
echo __('Language');
?>
:</h3>
<ul>
<?php
foreach ($item->PeopleLanguages as $lang) {
?>
<li>
<?php
echo format_language($lang->getLanguageCountry());
?>
<?php
if ($lang->getMother()) {
?>
<?php
echo __('(mother)');
?>
<?php
}
?>
<?php
if ($lang->getPreferredLanguage()) {
?>
<?php
开发者ID:naturalsciences,项目名称:Darwin,代码行数:31,代码来源:detailsSuccess.php
示例4: foreach
<?php
$languages = '';
if (is_array($vocabulary->getLanguages())) {
foreach ($vocabulary->getLanguages() as $language) {
$languages .= format_language($language) . ", ";
}
$languages = rtrim($languages, ", ");
}
echo $languages;
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:10,代码来源:_languages.php
示例5: getFormatLanguage
/**
* Gets the language
*
* @param string $culture
*
* @return string The formatted language
*/
public function getFormatLanguage($culture = null)
{
return format_language(parent::getLanguage(), $culture);
}
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:11,代码来源:SchemaPropertyElement.php
示例6: simple_format_text
<h1><?php
echo $article['title'];
?>
</h1>
<?php
echo simple_format_text($article['content']);
?>
<ul>
<?php
foreach (sfConfig::get('app_cultures_available', array()) as $lang) {
?>
<li>
<?php
echo format_language($lang);
?>
<?php
echo link_to($article['Translation'][$lang]['title'], 'article', array('sf_subject' => $article['Translation'][$lang], 'sf_culture' => $lang));
?>
</li>
<?php
}
?>
</ul>
<h3>Comments</h3>
<ul id="comments">
<?php
foreach ($article['Comments'] as $comment) {
开发者ID:n1k0,项目名称:akDoctrineTemplateCacheInvaliderPlugin,代码行数:31,代码来源:articleSuccess.php
示例7: setupAdminMenu
/**
* Listens to the sympal.load_admin_menu to configure the admin menu
*/
public function setupAdminMenu(sfEvent $event)
{
$menu = $event->getSubject();
// Setup the Content menu
$manageContent = $menu->getChild('content');
$manageContent->setLabel('Content');
$manageContent->addChild('Search', '@sympal_admin_search');
$contentTypes = Doctrine_Core::getTable('sfSympalContentType')->getAllContentTypes();
foreach ($contentTypes as $contentType) {
$manageContent->addChild($contentType->getLabel(), '@sympal_content_list_type?type=' . $contentType->getId())->setCredentials(array('ManageContent'));
}
$manageContent->addChild('Slots', '@sympal_content_slots')->setCredentials(array('ManageSlots'));
$manageContent->addChild('XML Sitemap', '@sympal_sitemap')->setCredentials(array('ViewXmlSitemap'));
// Setup the Site Administration menu
$siteAdministration = $menu->getChild('site_administration');
$siteAdministration->setLabel('Site Administration');
$siteAdministration->addChild('404 Redirects', '@sympal_redirects')->setCredentials(array('ManageRedirects'));
$siteAdministration->addChild('Edit Site', '@sympal_sites_edit?id=' . sfSympalContext::getInstance()->getService('site_manager')->getSite()->getId())->setCredentials(array('ManageSites'));
// Add to the Administration menu
$administration = $menu->getChild('administration');
$administration->addChild('Content Types', '@sympal_content_types')->setCredentials(array('ManageContentTypes'));
$administration->addChild('Sites', '@sympal_sites')->setCredentials(array('ManageSites'));
// Add a Content menu if applicable
$content = $this->_sympalContext->getService('site_manager')->getCurrentContent();
if ($content) {
$contentEditor = $menu->getChild($content->getType()->slug);
$contentEditor->setLabel(sprintf(__('%s Actions'), $content->getType()->getLabel()));
// If in the admin, put a link to view the content
if (sfSympalConfiguration::getActive()->isAdminModule()) {
$contentEditor->addChild(sprintf(__('View %s'), $content->getType()->getLabel()), $content->getRoute());
}
$contentEditor->addChild(sprintf(__('Create New %s'), $content->getType()->getLabel()), '@sympal_content_create_type?type=' . $content['Type']['slug'])->setCredentials('ManageContent');
$contentEditor->addChild(sprintf(__('Edit %s'), $content->getType()->getLabel()), $content->getEditRoute())->setCredentials('ManageContent');
$contentEditor->addChild(__('Edit Content Type'), '@sympal_content_types_edit?id=' . $content->getType()->getId())->setCredentials('ManageMenus');
// Add a menu item entry
$menuItem = $this->_sympalContext->getService('menu_manager')->getCurrentMenuItem();
if ($menuItem && $menuItem->exists()) {
$contentEditor->addChild(__('Edit Menu Item'), '@sympal_content_menu_item?id=' . $content->getId())->setCredentials('ManageMenus');
} else {
$contentEditor->addChild(__('Add to Menu'), '@sympal_content_menu_item?id=' . $content->getId())->setCredentials('ManageMenus');
}
// Add publish/unpublish icons
$user = sfContext::getInstance()->getUser();
if ($user->hasCredential('PublishContent')) {
if ($content->getIsPublished()) {
$contentEditor->addChild(__('Unpublish'), '@sympal_unpublish_content?id=' . $content->id, 'title=' . __('Published on %date%', array('%date%' => format_date($content->getDatePublished(), 'g'))) . '. ' . __('Click to unpublish content.'));
} elseif ($content->getIsPublishInTheFuture()) {
$contentEditor->addChild(__('Unpublish'), '@sympal_unpublish_content?id=' . $content->id, 'title=' . __('Will publish on %date%', array('%date%' => format_date($content->getDatePublished(), 'g'))) . '. ' . __('Click to unpublish content.'));
} else {
$contentEditor->addChild(__('Publish'), '@sympal_publish_content?id=' . $content->id, 'title=' . __('Has not been published yet. ' . __('Click to publish content.')));
}
}
if (sfSympalConfig::isI18nEnabled()) {
foreach (sfSympalConfig::getLanguageCodes() as $code) {
if (sfContext::getInstance()->getUser()->getEditCulture() != $code) {
$contentEditor->addChild(sprintf(__('Edit in %s'), format_language($code)), '@sympal_change_edit_language?language=' . $code, 'title=' . sprintf(__('Edit %s version'), format_language($code)));
}
}
}
}
}
开发者ID:sympal,项目名称:sympal,代码行数:64,代码来源:sfSympalPluginConfiguration.class.php
示例8: foreach
<?php
$languagesOut = '';
/** @var $vocabulary_has_user VocabularyHasUser */
$languages = $vocabulary_has_user->getLanguages();
if (is_array($languages)) {
foreach ($languages as $language) {
$languagesOut .= format_language($language) . ", ";
}
$languagesOut = rtrim($languagesOut, ", ");
}
echo $languagesOut;
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:12,代码来源:_languages.php
示例9: format_language
<?php
echo format_language($vocabulary->getLanguage());
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:3,代码来源:_language.php
示例10: __
</span>
<div class="label strings">
<h2><?php
echo __('Page text');
?>
</h2>
</div>
<div class="label source">
<h2><?php
echo __('Source');
?>
</h2>
</div>
<div class="label translation">
<h2><?php
echo __('%language% translation', array('%language%' => format_language($sf_user->getCulture())));
?>
</h2>
</div>
</div>
<div id="l10n-client-string-select">
<ul class="string-list">
<?php
foreach ($sf_data->getRaw('messages') as $source => $target) {
?>
<li><?php
echo truncate_text(empty($target) ? $source : $target);
?>
</li>
<?php
}
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:31,代码来源:_translate.php
示例11: foreach
foreach ($dc->format as $item) {
?>
<?php
echo render_show(__('Format'), render_value($item));
}
?>
<?php
echo render_show(__('Source'), render_value($resource->getLocationOfOriginals(array('cultureFallback' => true))));
?>
<?php
foreach ($resource->language as $code) {
?>
<?php
echo render_show(__('Language'), format_language($code));
}
?>
<?php
echo render_show_repository(__('Relation (isLocatedAt)'), $resource);
?>
<?php
foreach ($dc->coverage as $item) {
?>
<?php
echo render_show(__('Coverage (spatial)'), link_to(render_title($item), array($item, 'module' => 'term', 'action' => 'browseTerm')));
}
?>
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:30,代码来源:indexSuccess.php
示例12: foreach
</tr>
</thead>
<tbody>
<?php
foreach ($i18nLanguages as $setting) {
?>
<tr>
<td>
<?php
echo $setting->getName();
?>
</td>
<td>
<?php
echo format_language($setting->getName());
?>
</td>
<td>
<?php
if ($setting->deleteable) {
?>
<?php
echo link_to(image_tag('delete'), array($setting, 'module' => 'settings', 'action' => 'delete'));
?>
<?php
}
?>
</td>
</tr>
<?php
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:31,代码来源:listSuccess.php
示例13: buildDefaultLanguage
/**
*
* Function that returns the defualt language
*
* @param String $language, e.g. en_US, de_DE
* @return String, formated in correct language, e.g. English, German
*/
public static function buildDefaultLanguage($language) {
sfLoader::loadHelpers('I18N');
$result = array();
$result = explode('_', $language);
return format_language($result[0]);
}
开发者ID:rlauenroth,项目名称:cuteflow_v3,代码行数:13,代码来源:Language.class.php
示例14: format_language
<?php
echo format_language($vocabulary_has_user->getDefaultLanguage());
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:3,代码来源:_default_language.php
示例15: __
<a class="menu" href="#"><?php
echo __('Language');
?>
</a>
<ul>
<?php
foreach (sfConfig::getAll() as $name => $value) {
?>
<?php
if ('app_i18n_languages' == substr($name, 0, 18)) {
?>
<li<?php
if ($sf_user->getCulture() == $value) {
?>
class="active"<?php
}
?>
><?php
echo link_to(format_language($value, $value), array('sf_culture' => $value) + $sf_request->getParameterHolder()->getAll());
?>
</li>
<?php
}
?>
<?php
}
?>
</ul>
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:29,代码来源:_changeLanguageList.php
示例16: foreach
<ul>
<?php
$nodes = $root->getBranch();
?>
<?php
foreach ($nodes as $page_pk) {
?>
<li class="<?php
echo $page_pk->getIsPublished() ? 'published' : 'unpublished';
?>
">
<?php
foreach (sfPlop::get('sf_plop_cultures') as $localization) {
?>
<?php
echo link_to(image_flag($localization, array('alt' => format_language($localization))), '@sf_plop_page_show?slug=' . $page_pk->getSlug() . '&sf_culture=' . $localization, array('class' => 'element flag w-img-link', 'title' => $page_pk->getSlug()));
?>
<?php
}
?>
<?php
echo link_to_unless($page->getSlug() == $page_pk->getSlug(), str_repeat('-', $page_pk->getLevel()) . ' ' . $page_pk->getSlug(), '@sf_plop_page_show?sf_culture=' . $culture . '&slug=' . $page_pk->getSlug(), array('class' => 'element', 'title' => $page_pk->getSlug()));
?>
<?php
echo widgetIndicator($page_pk->isTemplate(), 'edit', __('This indicates if the page is a template (lock icon).', '', 'plopAdmin'), array('rel' => $page_pk->getSlug()));
?>
<?php
echo widgetIndicator($page_pk->isPublished(), 'publish', __('This indicates if the page is published (green tick) or not (red bullet).', '', 'plopAdmin'), array('rel' => $page_pk->getSlug()));
?>
</li>
<?php
开发者ID:noreiller,项目名称:sfPlopPlugin,代码行数:31,代码来源:_toolbarCMS.php
示例17: loadConfigForm
/**
* Listens to sympal.load_config_form to load the configuration form
*/
public function loadConfigForm(sfEvent $event)
{
$form = $event->getSubject();
if (sfSympalConfig::isI18nEnabled()) {
$cultures = sfCultureInfo::getCultures(sfCultureInfo::NEUTRAL);
$languages = array();
foreach ($cultures as $key => $value) {
$formatted = format_language($value);
if (!$formatted) {
$formatted = format_language($value, 'en');
}
if ($formatted) {
$languages[$value] = $formatted;
}
}
asort($languages);
$widget = new sfWidgetFormChoice(array('multiple' => true, 'choices' => $languages));
$validator = new sfValidatorChoice(array('multiple' => true, 'choices' => array_keys($languages)));
$form->addSetting(null, 'language_codes', 'Available Cultures', $widget, $validator);
$languageForm = new sfFormLanguage(sfContext::getInstance()->getUser(), array('languages' => sfSympalConfig::getLanguageCodes()));
$widgetSchema = $languageForm->getWidgetSchema();
$validatorSchema = $languageForm->getValidatorSchema();
$form->addSetting(null, 'default_culture', 'Default Culture', $widgetSchema['language'], $validatorSchema['language']);
}
$form->addSetting(null, 'default_rendering_module', 'Default Rendering Module');
$form->addSetting(null, 'default_rendering_action', 'Default Rendering Action');
$form->addSetting(null, 'breadcrumbs_separator', 'Breadcrumbs Separator');
$form->addSetting(null, 'elastic_textareas', 'Elastic Textareas', 'InputCheckbox', 'Boolean');
$form->addSetting(null, 'check_for_upgrades_on_dashboard', 'Check for Upgrades', 'InputCheckbox', 'Boolean');
$form->addSetting('page_cache', 'enabled', 'Enabled?', 'InputCheckbox', 'Boolean');
$form->addSetting('page_cache', 'super', 'Enable Super Cache?', 'InputCheckbox', 'Boolean');
$form->addSetting('page_cache', 'with_layout', 'With layout?', 'InputCheckbox', 'Boolean');
$form->addSetting('page_cache', 'lifetime', 'Lifetime');
}
开发者ID:sympal,项目名称:sympal,代码行数:37,代码来源:sfSympalAdminPluginConfiguration.class.php
示例18: import
//.........这里部分代码省略.........
// instantiate an XSLT parser
$xslDOM = new DOMDocument();
$xslDOM->load($importXSL);
// Configure the transformer
$xsltProc = new XSLTProcessor();
$xsltProc->registerPHPFunctions();
$xsltProc->importStyleSheet($xslDOM);
$importDOM->loadXML($xsltProc->transformToXML($importDOM));
unset($xslDOM);
unset($xsltProc);
} else {
$this->errors[] = sfContext::getInstance()->i18n->__('Unable to load import XSL filter: "%importXSL%"', array('%importXSL%' => $importXSL));
}
}
// re-initialize xpath on the new XML
$importDOM->xpath = new DOMXPath($importDOM);
}
// switch source culture if langusage is set in an EAD document
if ($importSchema == 'ead') {
if (is_object($langusage = $importDOM->xpath->query('//eadheader/profiledesc/langusage/language/@langcode'))) {
$sf_user = sfContext::getInstance()->user;
$currentCulture = $sf_user->getCulture();
$langCodeConvertor = new fbISO639_Map();
foreach ($langusage as $language) {
$isocode = trim(preg_replace('/[\\n\\r\\s]+/', ' ', $language->nodeValue));
// convert to Symfony culture code
if (!($twoCharCode = strtolower($langCodeConvertor->getID2($isocode)))) {
$twoCharCode = $isocode;
}
// Check to make sure that the selected language is supported with a Symfony i18n data file.
// If not it will cause a fatal error in the Language List component on every response.
ProjectConfiguration::getActive()->loadHelpers('I18N');
try {
format_language($twoCharCode, $twoCharCode);
} catch (Exception $e) {
$this->errors[] = sfContext::getInstance()->i18n->__('EAD "langmaterial" is set to') . ': "' . $isocode . '". ' . sfContext::getInstance()->i18n->__('This language is currently not supported.');
continue;
}
if ($currentCulture !== $twoCharCode) {
$this->errors[] = sfContext::getInstance()->i18n->__('EAD "langmaterial" is set to') . ': "' . $isocode . '" (' . format_language($twoCharCode, 'en') . '). ' . sfContext::getInstance()->i18n->__('Your XML document has been saved in this language and your user interface has just been switched to this language.');
}
$sf_user->setCulture($twoCharCode);
// can only set to one language, so have to break once the first valid language is encountered
break;
}
}
}
unset($this->schemaMap['processXSLT']);
// go through schema map and populate objects/properties
foreach ($this->schemaMap as $name => $mapping) {
// if object is not defined or a valid class, we can't process this mapping
if (empty($mapping['Object']) || !class_exists('Qubit' . $mapping['Object'])) {
$this->errors[] = sfContext::getInstance()->i18n->__('Non-existent class defined in import mapping: "%class%"', array('%class%' => 'Qubit' . $mapping['Object']));
continue;
}
// get a list of XML nodes to process
$nodeList = $importDOM->xpath->query($mapping['XPath']);
foreach ($nodeList as $domNode) {
// create a new object
$class = 'Qubit' . $mapping['Object'];
$currentObject = new $class();
// set the rootObject to use for initial display in successful import
if (!$this->rootObject) {
$this->rootObject = $currentObject;
}
// if a parent path is specified, try to parent the node
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:67,代码来源:QubitXmlImport.class.php
示例19: image_tag
<div style="text-align: center;">
<?php
echo image_tag('lock48');
?>
<h2 style="font-size: 20px;"><?php
echo __('Sorry, you do not have permission to make %1% language translations', array('%1%' => format_language($sf_user->getCulture())));
?>
</h2>
<a href="javascript:history.go(-1)"><?php
echo __('Back to previous page');
?>
</a>
<br/>
<?php
echo link_to(__('Go to homepage'), '@homepage');
?>
</div>
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:20,代码来源:translatePermissionSuccess.php
示例20: format_language
<?php
echo format_language($schema->getLanguage());
开发者ID:jonphipps,项目名称:Metadata-Registry,代码行数:3,代码来源:_language.php
注:本文中的format_language函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论