本文整理汇总了PHP中I18n::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP I18n::initialize方法的具体用法?PHP I18n::initialize怎么用?PHP I18n::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类I18n
的用法示例。
在下文中一共展示了I18n::initialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initialize
/**
*
* Initializes configs for the APP to run
*/
public static function initialize()
{
/**
* Load all the configs from DB
*/
//Change the default cache system, based on your config /config/cache.php
Cache::$default = Core::config('cache.default');
//is not loaded yet in Kohana::$config
Kohana::$config->attach(new ConfigDB(), FALSE);
//overwrite default Kohana init configs.
Kohana::$base_url = Core::config('general.base_url');
//enables friendly url @todo from config
Kohana::$index_file = FALSE;
//cookie salt for the app
Cookie::$salt = Core::config('auth.cookie_salt');
/* if (empty(Cookie::$salt)) {
// @TODO missing cookie salt : add warning message
} */
// -- i18n Configuration and initialization -----------------------------------------
I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset'));
//Loading the OC Routes
// if (($init_routes = Kohana::find_file('config','routes')))
// require_once $init_routes[0];//returns array of files but we need only 1 file
//faster loading
require_once APPPATH . 'config/routes.php';
//getting the selected theme, and loading options
Theme::initialize();
}
示例2: initialize
/**
*
* Initializes configs for the APP to run
*/
public static function initialize()
{
//enables friendly url
Kohana::$index_file = FALSE;
//temporary cookie salt in case of exception
Cookie::$salt = 'cookie_oc_temp';
//Change the default cache system, based on your config /config/cache.php
Cache::$default = Core::config('cache.default');
//loading configs from table config
//is not loaded yet in Kohana::$config
Kohana::$config->attach(new ConfigDB(), FALSE);
//overwrite default Kohana init configs.
Kohana::$base_url = Core::config('general.base_url');
//cookie salt for the app
Cookie::$salt = Core::config('auth.cookie_salt');
// i18n Configuration and initialization
I18n::initialize(Core::config('i18n.locale'), Core::config('i18n.charset'));
//Loading the OC Routes
require_once APPPATH . 'config/routes.php';
//getting the selected theme, and loading options
Theme::initialize();
//run crontab
if (core::config('general.cron') == TRUE) {
Cron::run();
}
}
示例3: ready
/**
* Runs the Gleez environment
*
* @uses Gleez::_set_cookie
* @uses Route::set
* @uses Route::defaults
* @uses Config::load
* @uses I18n::initialize
* @uses Module::load_modules
*/
public static function ready()
{
if (self::$_init) {
// Do not allow execution twice
return;
}
// Gleez is now initialized?
self::$_init = TRUE;
// Set default cookie salt and lifetime
self::_set_cookie();
// Check database config file exist or not
Gleez::$installed = file_exists(APPPATH . 'config/database.php');
if (Gleez::$installed) {
// Database config reader and writer
Kohana::$config->attach(new Config_Database());
}
if (Kohana::$environment !== Kohana::DEVELOPMENT) {
Gleez_Exception::$error_view = 'errors/stack';
}
// Turn off notices and strict errors in production
if (Kohana::$environment === Kohana::PRODUCTION) {
// Turn off notices and strict errors
error_reporting(E_ALL ^ E_NOTICE ^ E_STRICT);
}
// Initialize the locale from settings
I18n::initialize();
// Disable the kohana powered headers
// @todo Remove it, use Gleez::$expose
Kohana::$expose = FALSE;
/**
* If database.php doesn't exist, then we assume that the Gleez is not
* properly installed and send to the installer.
*/
if (!Gleez::$installed) {
Session::$default = 'cookie';
Gleez_Exception::$error_view = 'errors/error';
// Static file serving (CSS, JS, images)
Route::set('install/media', 'media(/<file>)', array('file' => '.+'))->defaults(array('controller' => 'install', 'action' => 'media', 'file' => NULL, 'directory' => 'install'));
Route::set('install', '(install(/<action>))', array('action' => 'index|systemcheck|database|install|finalize'))->defaults(array('controller' => 'install', 'directory' => 'install'));
return;
}
// Set the default session type
Session::$default = Config::get('site.session_type');
// Initialize Gleez modules
Module::load_modules(FALSE);
// Load the active theme(s)
Theme::load_themes();
}
示例4: session_start
<?php
session_start();
// include constants
require_once 'lib/php/constants.php';
// include classloader and register it to autoloading
require_once 'lib/php/classloader.php';
spl_autoload_register('loadClass');
// start session and save client
require_once 'lib/php/functions/client.register.php';
// set content language
I18n::initialize();
// load current page content and required JS files
$currentPage = FileFunctions::getCurrentPage();
$externalJS = JavaScriptIncluder::getExternalJSFiles($currentPage);
$customJS = JavaScriptIncluder::getCustomJSFiles($currentPage);
?>
<!DOCTYPE html>
<html lang="<?php
echo I18n::getLang();
?>
">
<head>
<meta charset="utf-8">
<title>hiragana.ch</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="Learn Hiragana and Katakana" />
<meta name="keywords" content="hiragana katakana kana trainer japanese japanisch PHP" />
<meta name="author" content="Steven Cardini, Raphael Laubscher" />