本文整理汇总了PHP中TAdiantiCoreTranslator::setLanguage方法的典型用法代码示例。如果您正苦于以下问题:PHP TAdiantiCoreTranslator::setLanguage方法的具体用法?PHP TAdiantiCoreTranslator::setLanguage怎么用?PHP TAdiantiCoreTranslator::setLanguage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TAdiantiCoreTranslator
的用法示例。
在下文中一共展示了TAdiantiCoreTranslator::setLanguage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onLogin
/**
* Validate the login
*/
function onLogin()
{
try {
TTransaction::open('library');
$data = $this->form->getData('StdClass');
// validate form data
$this->form->validate();
$language = $data->language ? $data->language : 'en';
TAdiantiCoreTranslator::setLanguage($language);
TApplicationTranslator::setLanguage($language);
$auth = User::autenticate($data->{'user'}, $data->{'password'});
if ($auth) {
TSession::setValue('logged', TRUE);
TSession::setValue('login', $data->{'user'});
TSession::setValue('language', $data->language);
// reload page
TApplication::executeMethod('SetupPage', 'onSetup');
}
TTransaction::close();
// finaliza a transação
} catch (Exception $e) {
TSession::setValue('logged', FALSE);
// exibe a mensagem gerada pela exceção
new TMessage('error', '<b>Erro</b> ' . $e->getMessage());
// desfaz todas alterações no banco de dados
TTransaction::rollback();
}
}
示例2: __construct
/**
* Constructor Method
*/
function __construct()
{
parent::__construct();
parent::set_size_request(840, 640);
parent::set_position(GTK::WIN_POS_CENTER);
parent::connect_simple('delete-event', array($this, 'onClose'));
parent::connect_simple('destroy', array('Gtk', 'main_quit'));
parent::set_title(self::APP_TITLE);
parent::set_icon(GdkPixbuf::new_from_file('favicon.png'));
$gtk = GtkSettings::get_default();
$gtk->set_long_property("gtk-button-images", TRUE, 0);
$gtk->set_long_property("gtk-menu-images", TRUE, 0);
self::$inst = $this;
$ini = parse_ini_file('application.ini');
$lang = $ini['language'];
TAdiantiCoreTranslator::setLanguage($lang);
TApplicationTranslator::setLanguage($lang);
date_default_timezone_set($ini['timezone']);
$this->content = new GtkFixed();
$vbox = new GtkVBox();
parent::add($vbox);
$vbox->pack_start(GtkImage::new_from_file('app/images/pageheader-gtk.png'), false, false);
$MenuBar = TMenuBar::newFromXML('menu.xml');
$vbox->pack_start($MenuBar, false, false);
$vbox->pack_start($this->content, true, true);
parent::show_all();
}
示例3: run
public static function run($debug = FALSE)
{
new TSession();
$lang = TSession::getValue('language') ? TSession::getValue('language') : 'en';
TAdiantiCoreTranslator::setLanguage($lang);
TApplicationTranslator::setLanguage($lang);
if ($_REQUEST) {
$class = isset($_REQUEST['class']) ? $_REQUEST['class'] : '';
if (!TSession::getValue('logged') and $class !== 'LoginForm') {
echo TPage::getLoadedCSS();
echo TPage::getLoadedJS();
new TMessage('error', 'Not logged');
return;
}
parent::run($debug);
}
}
示例4: spl_autoload_register
<?php
// define the autoloader
include_once 'lib/adianti/util/TAdiantiLoader.class.php';
spl_autoload_register(array('TAdiantiLoader', 'autoload_web'));
// read configurations
$ini = parse_ini_file('application.ini');
date_default_timezone_set($ini['timezone']);
TAdiantiCoreTranslator::setLanguage($ini['language']);
TApplicationTranslator::setLanguage($ini['language']);
// define constants
define('APPLICATION_NAME', $ini['application']);
define('OS', strtoupper(substr(PHP_OS, 0, 3)));
define('PATH', dirname(__FILE__));
class TApplication extends TCoreApplication
{
public static function run($debug = FALSE)
{
new TSession();
if ($_REQUEST) {
parent::run($debug);
}
}
}
TApplication::run(TRUE);
示例5: TSession
<?php
require_once 'init.php';
$uri = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
new TSession();
$template = 'theme1';
$lang = TSession::getValue('language') ? TSession::getValue('language') : 'en';
TAdiantiCoreTranslator::setLanguage($lang);
TApplicationTranslator::setLanguage($lang);
if (TSession::getValue('logged')) {
TTransaction::open('library');
$member = User::newFromLogin(TSession::getValue('login'));
if ($member->role->mnemonic == 'LIBRARIAN') {
$content = file_get_contents("app/templates/{$template}/librarian.html");
} else {
if ($member->role->mnemonic == 'OPERATOR') {
$content = file_get_contents("app/templates/{$template}/operator.html");
} else {
if ($member->role->mnemonic == 'ADMINISTRATOR') {
$content = file_get_contents("app/templates/{$template}/admin.html");
}
}
}
TTransaction::close();
} else {
$content = file_get_contents("app/templates/{$template}/login.html");
}
$content = TApplicationTranslator::translateTemplate($content);
$content = str_replace('{LIBRARIES}', file_get_contents("app/templates/{$template}/libraries.html"), $content);
$content = str_replace('{URI}', $uri, $content);
$content = str_replace('{class}', isset($_REQUEST['class']) ? $_REQUEST['class'] : '', $content);