本文整理汇总了PHP中QApplication::LanguageCode方法的典型用法代码示例。如果您正苦于以下问题:PHP QApplication::LanguageCode方法的具体用法?PHP QApplication::LanguageCode怎么用?PHP QApplication::LanguageCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QApplication
的用法示例。
在下文中一共展示了QApplication::LanguageCode方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: InitializeI18n
/**
* Method will setup Internationalization.
* NOTE: This method has been INTENTIONALLY left incomplete.
* @return void
*/
public static function InitializeI18n()
{
if (isset($_SESSION)) {
if (array_key_exists('country_code', $_SESSION)) {
QApplication::$CountryCode = $_SESSION['country_code'];
}
if (array_key_exists('language_code', $_SESSION)) {
QApplication::$LanguageCode = $_SESSION['language_code'];
}
}
/*
* NOTE: This is where you would implement code to do Language Setting discovery, as well, for example:
* Checking against $_GET['language_code']
* checking against session (example provided below)
* Checking the URL
* etc.
* Options to do this are left to the developer.
*/
// Initialize I18n if QApplication::$LanguageCode is set
if (QApplication::$LanguageCode) {
QI18n::Initialize();
} else {
// QApplication::$CountryCode = 'us';
// QApplication::$LanguageCode = 'en';
// QI18n::Initialize();
}
}
示例2: button_Click
protected function button_Click($strFormId, $strControlId, $strParameter)
{
// NORMALLY -- these settings are setup in prepend.inc
// But it is pulled out here to illustrate
$_SESSION['language_code'] = $strParameter;
// In order for I18n Translation to be enabled, you must have a language code
// defined and the QI18n object must be initialized
QApplication::$LanguageCode = $strParameter;
QI18n::Initialize();
}
示例3: Form_Create
protected function Form_Create()
{
// let's change translation class
require_once 'sample_translator.class.php';
QI18n::$DefaultTranslationClass = 'QSampleTranslation';
// Set default language to French
QApplication::$LanguageCode = 'fr';
QApplication::$CountryCode = null;
QI18n::Initialize();
}
示例4: setCustomTranslatorClass
private function setCustomTranslatorClass()
{
require_once __DOCROOT__ . __EXAMPLES__ . '/communication/sample_translator.class.php';
// let's change translation class
QI18n::$DefaultTranslationClass = 'QSampleTranslation';
// Set default language to French
QApplication::$LanguageCode = 'fr';
QApplication::$CountryCode = null;
QI18n::Initialize();
}
示例5:
// Start Session Handler (if required)
/////////////////////////////
//session_set_cookie_params(2);
session_start();
//////////////////////////////////////////////
// Setup Internationalization and Localization (if applicable)
// Note, this is where you would implement code to do Language Setting discovery, as well, for example:
// * Checking against $_GET['language_code']
// * checking against session (example provided below)
// * Checking the URL
// * etc.
// TODO: options to do this are left to the developer
//////////////////////////////////////////////
if (isset($_SESSION)) {
if (array_key_exists('country_code', $_SESSION)) {
QApplication::$CountryCode = $_SESSION['country_code'];
}
if (array_key_exists('language_code', $_SESSION)) {
QApplication::$LanguageCode = $_SESSION['language_code'];
}
}
QApplication::$LanguageCode = 'zh_cn';
// Initialize I18n if QApplication::$LanguageCode is set
if (QApplication::$LanguageCode) {
QI18n::Initialize();
} else {
// QApplication::$CountryCode = 'us';
// QApplication::$LanguageCode = 'en';
// QI18n::Initialize();
}
}
示例6:
QApplication::InitializeDatabaseConnections();
/////////////////////////////
// Start Session Handler (if required)
/////////////////////////////
session_start();
//////////////////////////////////////////////
// Setup Internationalization and Localization (if applicable)
// Note, this is where you would implement code to do Language Setting discovery, as well, for example:
// * Checking against $_GET['language_code']
// * checking against session (example provided below)
// * Checking the URL
// * etc.
// TODO: options to do this are left to the developer
//////////////////////////////////////////////
if (isset($_SESSION)) {
if (array_key_exists('country_code', $_SESSION)) {
QApplication::$CountryCode = $_SESSION['country_code'];
}
if (array_key_exists('language_code', $_SESSION)) {
QApplication::$LanguageCode = $_SESSION['language_code'];
}
}
// Initialize I18n if QApplication::$LanguageCode is set
if (QApplication::$LanguageCode) {
QI18n::Initialize();
} else {
// QApplication::$CountryCode = 'us';
// QApplication::$LanguageCode = 'en';
// QI18n::Initialize();
}
}
示例7: InitializeTranslationEngine
public static function InitializeTranslationEngine()
{
require_once __NARRO_INCLUDES__ . '/gettext_reader.class.php';
require_once __NARRO_INCLUDES__ . '/StreamReader.class.php';
if (QApplication::$User->UserId == NarroUser::ANONYMOUS_USER_ID) {
QApplication::$LanguageCode = QApplication::$TargetLanguage->LanguageCode;
} else {
QApplication::$LanguageCode = QApplication::$User->GetPreferenceValueByName('Application language');
}
define('__LOCALE_DIRECTORY__', __DOCROOT__ . __SUBDIRECTORY__ . '/locale/' . QApplication::$LanguageCode);
QI18n::Initialize('NarroPoParser');
}
示例8:
/////////////////////////////
if (strstr($_SERVER['SCRIPT_NAME'], 'codegen.php') === false) {
/////////////////////////////
// Start Session Handler (if required)
/////////////////////////////
require_once 'Zend/Session.php';
Zend_Session::setOptions(array('cookie_lifetime' => 31 * 24 * 3600, 'gc_maxlifetime' => 31 * 24 * 3600));
require_once 'Zend/Session/Namespace.php';
$objSession = new Zend_Session_Namespace('SubmitWord');
QApplication::$User = $objSession->User;
}
//////////////////////////////////////////////
// Setup Internationalization and Localization (if applicable)
// Note, this is where you would implement code to do Language Setting discovery, as well, for example:
// * Checking against $_GET['language_code']
// * checking against session (example provided below)
// * Checking the URL
// * etc.
// TODO: options to do this are left to the developer
//////////////////////////////////////////////
QApplication::$CountryCode = 'ro';
QApplication::$LanguageCode = 'ro';
// Initialize I18n if QApplication::$LanguageCode is set
if (QApplication::$LanguageCode) {
QI18n::Initialize();
} else {
// QApplication::$CountryCode = 'us';
// QApplication::$LanguageCode = 'en';
// QI18n::Initialize();
}
}