本文整理汇总了PHP中Kohana::language方法的典型用法代码示例。如果您正苦于以下问题:PHP Kohana::language方法的具体用法?PHP Kohana::language怎么用?PHP Kohana::language使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kohana
的用法示例。
在下文中一共展示了Kohana::language方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: locale
/**
* Sets the environment locale. The first locale must always be a valid
* `xx_XX` locale name to be used for i18n:
*
* Kohana::locale(array('de_DE@euro.UTF-8', 'de_DE.UTF-8', 'german'));
*
* When using this method, it is a good idea to provide many variations, as
* locale availability on different systems is very unpredictable.
*
* @param array locale choices
* @return void
*/
public static function locale(array $locales)
{
if (setlocale(LC_ALL, $locales) !== FALSE) {
// Set the system locale
self::$locale = substr($locales[0], 0, 5);
if (($messages = Kohana::cache('kohana_i18n_' . self::$locale)) === NULL) {
// Find all this languages translation files
$files = self::find_file('i18n', self::$locale);
$messages = array();
foreach ($files as $file) {
// Load the messages in this file
$messages = array_merge($messages, include $file);
}
// Cache the combined messages
Kohana::cache('kohana_i18n_' . self::$locale, $messages);
}
// Load the language internally
self::$language = $messages;
}
}
示例2:
<title><?php
echo Kohana::language('simplegroups.no');
?>
</title>
<link rel="stylesheet" type="text/css" href="<?php
echo url::site();
?>
media/css/error.css" />
</head>
<body>
<div id="error">
<h1><?php
echo Kohana::language('simplegroups.error');
?>
</h1><?php
echo Kohana::language('simplegroups.sorry');
?>
<a href="<?php
echo url::site();
?>
logout"><?php
echo Kohana::lang('ui_admin.logout');
?>
</a><?php
echo Kohana::language('simplegroups.you');
?>
</div>
</body>
</html>