Added Kohana v3.0.9
This commit is contained in:
50
includes/kohana/system/base.php
Normal file
50
includes/kohana/system/base.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php defined('SYSPATH') or die('No direct script access.');
|
||||
|
||||
if ( ! defined('KOHANA_START_TIME'))
|
||||
{
|
||||
/**
|
||||
* Define the start time of the application, used for profiling.
|
||||
*/
|
||||
define('KOHANA_START_TIME', microtime(TRUE));
|
||||
}
|
||||
|
||||
if ( ! defined('KOHANA_START_MEMORY'))
|
||||
{
|
||||
/**
|
||||
* Define the memory usage at the start of the application, used for profiling.
|
||||
*/
|
||||
define('KOHANA_START_MEMORY', memory_get_usage());
|
||||
}
|
||||
|
||||
/**
|
||||
* Kohana translation/internationalization function. The PHP function
|
||||
* [strtr](http://php.net/strtr) is used for replacing parameters.
|
||||
*
|
||||
* __('Welcome back, :user', array(':user' => $username));
|
||||
*
|
||||
* [!!] The target language is defined by [I18n::$lang]. The default source
|
||||
* language is defined by [I18n::$source].
|
||||
*
|
||||
* @uses I18n::get
|
||||
* @param string text to translate
|
||||
* @param array values to replace in the translated text
|
||||
* @param string source language
|
||||
* @return string
|
||||
*/
|
||||
function __($string, array $values = NULL, $source = NULL)
|
||||
{
|
||||
if ( ! $source)
|
||||
{
|
||||
// Use the default source language
|
||||
$source = I18n::$source;
|
||||
}
|
||||
|
||||
if ($source !== I18n::$lang)
|
||||
{
|
||||
// The message and target languages are different
|
||||
// Get the translation for this message
|
||||
$string = I18n::get($string);
|
||||
}
|
||||
|
||||
return empty($values) ? $string : strtr($string, $values);
|
||||
}
|
Reference in New Issue
Block a user