本文整理汇总了PHP中format_language函数的典型用法代码示例。如果您正苦于以下问题:PHP format_language函数的具体用法?PHP format_language怎么用?PHP format_language使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了format_language函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: format_language
<?php
echo format_language($schema_property_element_history->getLanguage());
示例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
示例4: foreach
<?php
$languages = '';
if (is_array($vocabulary->getLanguages())) {
foreach ($vocabulary->getLanguages() as $language) {
$languages .= format_language($language) . ", ";
}
$languages = rtrim($languages, ", ");
}
echo $languages;
示例5: getFormatLanguage
/**
* Gets the language
*
* @param string $culture
*
* @return string The formatted language
*/
public function getFormatLanguage($culture = null)
{
return format_language(parent::getLanguage(), $culture);
}
示例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) {
示例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)));
}
}
}
}
}
示例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;
示例9: format_language
<?php
echo format_language($vocabulary->getLanguage());
示例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
}
示例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')));
}
?>
示例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
示例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]);
}
示例14: format_language
<?php
echo format_language($vocabulary_has_user->getDefaultLanguage());
示例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>