本文整理汇总了PHP中l10n::getLanguageName方法的典型用法代码示例。如果您正苦于以下问题:PHP l10n::getLanguageName方法的具体用法?PHP l10n::getLanguageName怎么用?PHP l10n::getLanguageName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类l10n
的用法示例。
在下文中一共展示了l10n::getLanguageName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doChangePostLang
public static function doChangePostLang($core, dcPostsActionsPage $ap, $post)
{
$posts_ids = $ap->getIDs();
if (empty($posts_ids)) {
throw new Exception(__('No entry selected'));
}
if (isset($post['new_lang'])) {
$new_lang = $post['new_lang'];
$cur = $core->con->openCursor($core->prefix . 'post');
$cur->post_lang = $new_lang;
$cur->update('WHERE post_id ' . $core->con->in($posts_ids));
dcPage::addSuccessNotice(sprintf(__('%d entry has been successfully set to language "%s"', '%d entries have been successfully set to language "%s"', count($posts_ids)), count($posts_ids), html::escapeHTML(l10n::getLanguageName($new_lang))));
$ap->redirect(true);
} else {
$ap->beginPage(dcPage::breadcrumb(array(html::escapeHTML($core->blog->name) => '', $ap->getCallerTitle() => $ap->getRedirection(true), __('Change language for this selection') => '')));
# lang list
# Languages combo
$rs = $core->blog->getLangs(array('order' => 'asc'));
$all_langs = l10n::getISOcodes(0, 1);
$lang_combo = array('' => '', __('Most used') => array(), __('Available') => l10n::getISOcodes(1, 1));
while ($rs->fetch()) {
if (isset($all_langs[$rs->post_lang])) {
$lang_combo[__('Most used')][$all_langs[$rs->post_lang]] = $rs->post_lang;
unset($lang_combo[__('Available')][$all_langs[$rs->post_lang]]);
} else {
$lang_combo[__('Most used')][$rs->post_lang] = $rs->post_lang;
}
}
unset($all_langs);
unset($rs);
echo '<form action="' . $ap->getURI() . '" method="post">' . $ap->getCheckboxes() . '<p><label for="new_lang" class="classic">' . __('Entry language:') . '</label> ' . form::combo('new_lang', $lang_combo, '');
echo $core->formNonce() . $ap->getHiddenFields() . form::hidden(array('action'), 'lang') . '<input type="submit" value="' . __('Save') . '" /></p>' . '</form>';
$ap->endPage();
}
}