示例#1
0
文件: kohana.php 项目: ascseb/kohana
 /**
  * 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
0
<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>