本文整理汇总了PHP中i18n::l方法的典型用法代码示例。如果您正苦于以下问题:PHP i18n::l方法的具体用法?PHP i18n::l怎么用?PHP i18n::l使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类i18n
的用法示例。
在下文中一共展示了i18n::l方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
foreach ($skins as $id => $attributes) {
// skip invalid skins -- for example, obsoleted skins
if (!file_exists($context['path_to_root'] . $id . '/template.php')) {
continue;
}
// style description
$text = '';
// the style title
if ($label = i18n::l($attributes, 'label')) {
if ($context['skin'] == $id) {
$label .= ' <span class="details">' . i18n::s('current theme') . '</span>';
}
$text .= Skin::build_block($label, 'title');
}
// style description
if ($description = i18n::l($attributes, 'description')) {
$text .= '<p>' . Codes::beautify($description) . '</p>';
}
// a small menu
$menu = array();
// test the skin
$menu = array_merge($menu, array('skins/test.php?skin=' . substr($id, 6) => i18n::s('Test this theme')));
// commands for associates
if (Surfer::is_associate()) {
// this skin is not yet used
if ($context['skin'] != $id) {
$menu = array_merge($menu, array('control/configure.php?parameter=skin&value=' . $id => i18n::s('Use this theme')));
}
// configure the theme
if (file_exists($context['path_to_root'] . $id . '/configure.php')) {
$menu = array_merge($menu, array($id . '/configure.php' => i18n::s('Configure this theme')));
示例2: sprintf
if (isset($hook['source']) && $hook['source']) {
$text .= '- ' . sprintf(i18n::s('source: %s'), $hook['source']) . BR . "\n";
}
$text .= "</dd>\n\n";
// remember for later use
$calls[$id] = $text;
break;
case 'serve':
// form item
$input = '<input type="checkbox" name="' . $id . '" value="Y" checked="checked" />';
// description
if ($description = i18n::l($hook, 'description')) {
$description .= BR;
}
// user information
$text = '<dt>' . $input . ' <b>' . i18n::l($hook, 'label') . '</b></dt><dd>' . $description . "\n";
if (isset($hook['id']) && $hook['id']) {
$text .= '- ' . sprintf(i18n::s('service: %s'), $hook['id']) . BR . "\n";
}
if (isset($hook['script']) && $hook['script']) {
$text .= '- ' . sprintf(i18n::s('script: %s'), $hook['script']) . BR . "\n";
}
if ($hook['function'] && $hook['function']) {
$text .= '- ' . sprintf(i18n::s('function: %s'), $hook['function']) . BR . "\n";
}
if (isset($hook['source']) && $hook['source']) {
$text .= '- ' . sprintf(i18n::s('source: %s'), $hook['source']) . BR . "\n";
}
$text .= "</dd>\n\n";
// remember for later use
$services[$id] = $text;
示例3:
/**
* get a localized string for a surfer
*
* To localize strings internally you should put alternative strings in the $local array, and use
* this function to select the correct version.
*
* Example:
* [php]
* $local['mystring_en'] = 'my string';
* $local['mystring_fr'] = 'ma chaine de caracteres';
* $text = i18n::user('mystring');
* [/php]
*
* This function also transcode HTML entities to Unicode entities, if any.
*
* @param string the label identifying string
* @param string desired language, if any
* @return string the localized string, if any
*/
public static function &user($name, $forced = '')
{
global $local;
$text =& i18n::l($local, $name, $forced);
return $text;
}