本文整理汇总了PHP中Locales类的典型用法代码示例。如果您正苦于以下问题:PHP Locales类的具体用法?PHP Locales怎么用?PHP Locales使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Locales类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: indexAction
function indexAction()
{
$params = array('locale_code' => $this->locale_code, 'request' => $this->getRequest());
if ($this->_auth->hasIdentity()) {
$params['is_admin'] = $this->_identity->isAdmin;
} else {
$params['is_admin'] = false;
}
$additional = $this->_Bolts_plugin->doFilter($this->_mca, $params);
// FILTER HOOK
foreach ($additional as $key => $value) {
$this->view->{$key} = $value;
}
// $this->view->welcome = $this->_T("Welcome!");
// TODO - find out if there is a valid cookie
// then redirect to that locale
// or redirect to the default locale
// ONLY if localization is enabled
// if localization is enabled and the URI does not contain a locale code
// and there is not a valid locale cookie
// redirect to a URI that contains the default locale code
if (Bolts_Registry::get('enable_localization') == '1') {
$locales_table = new Locales();
$locale_codes = $locales_table->getLocaleCodes(true);
$uri_parts = explode("/", trim($this->_uri, "/"));
if (count($uri_parts) > 0 && !in_array($uri_parts[0], $locale_codes)) {
// redirect method will automatically add the correct locale code to the URI
$this->_redirect("/");
}
}
}
开发者ID:jaybill,项目名称:Bolts,代码行数:31,代码来源:IndexController.php
示例2: execute
function execute()
{
$locale = new Locales('connection');
$list = $locale->getList();
$this->smarty->assign('lang', $list);
$this->smarty->assign('slide', connectionSliderModel::create()->where(array('id' => (int) Request::post('id')))->fetchOne());
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:7,代码来源:connectionSliderEdite.action.php
示例3: execute
function execute()
{
$app = strtolower(Request::get('app_local'));
$locale = new Locales($app);
$locale->deleteTranslate(Request::get('local_iso'), Request::post('var'));
return false;
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:7,代码来源:coreLocalizationDeleteValue.action.php
示例4: render
function render()
{
// load all the locale files
$locales = new Locales();
$siteLocales = $locales->getLocales();
$this->setValue("locales", $siteLocales);
parent::render();
}
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:8,代码来源:adminsitelocaleslistview.class.php
示例5: execute
function execute()
{
$model = connectionSliderModel::create();
$locale = new Locales('connection');
$list = $locale->getList();
$this->smarty->assign('slides', $model->sort('sort', -1)->fetchAll());
$this->smarty->assign('lang', $list);
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:8,代码来源:connectionSliderList.action.php
示例6: execute
function execute()
{
$locale = new Locales('connection');
$list = $locale->getList();
$page = Request::post('page');
$this->smarty->assign('seo', connectionSeoModel::create()->getByPage($page));
$this->smarty->assign('lang', $list);
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:8,代码来源:connectionSeoGetPage.action.php
示例7: Locales
public function &GetLocales()
{
if (!isset($this->_locales)) {
$locales = new Locales();
$locales->LoadAll();
$this->_locales = $locales;
}
return $this->_locales;
}
开发者ID:jhogan,项目名称:nplay,代码行数:9,代码来源:GlobalSingleton.php
示例8: execute
function execute()
{
$locale = new Locales('connection');
$list = $locale->getList();
$pageModel = new connectionPagesModel();
$this->smarty->assign('pages', $pageModel->fetchAll());
$this->smarty->assign('lang', $list);
$this->smarty->assign('page_url', Settings::getValue('page_url'));
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:9,代码来源:connectionPagesList.action.php
示例9: execute
function execute()
{
$this->frame = false;
$locale = new Locales('connection');
$list = $locale->getList();
$this->smarty->assign('lang', $list);
$fieldID = Request::post('id');
$model = new connectionFieldsModel();
$this->smarty->assign('field', $model->getField($fieldID));
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:10,代码来源:connectionFieldsEdite.action.php
示例10: execute
function execute()
{
$locale = new Locales('connection');
$list = $locale->getList();
if (Request::post('id')) {
$answer = connectionFaqAnswerModel::create()->where(array('id' => (int) Request::post('id')))->fetchOne();
$this->smarty->assign('answer', $answer);
}
$this->smarty->assign('lang', $list);
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:10,代码来源:connectionFaqEditeAnswer.action.php
示例11: execute
function execute()
{
$locale = new Locales('connection');
$list = $locale->getList();
$notification = connectionNotificationModel::create()->where(array('id' => (int) Request::post('id')))->fetchOne();
$eventList = connectionNotificationModel::getEventList();
$this->smarty->assign('eventInfo', $eventList[$notification['event']]);
$this->smarty->assign('lang', $list);
$this->smarty->assign('notification', $notification);
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:10,代码来源:connectionNotificationEdite.action.php
示例12: execute
function execute()
{
$event = Request::post('event');
$eventList = connectionNotificationModel::getEventList();
$locale = new Locales('connection');
$list = $locale->getList();
$this->smarty->assign('eventInfo', $eventList[$event]);
$this->smarty->assign('lang', $list);
$this->smarty->assign('event', connectionNotificationModel::create()->getEvent($event));
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:10,代码来源:connectionNotificationGetEvent.action.php
示例13: execute
function execute()
{
$locale = new Locales('connection');
$list = $locale->getList();
$this->smarty->assign('lang', $list);
$model = new connectionFieldsModel();
$fields = array();
$fields['info'] = $model->getGroup('info');
$fields['interest'] = $model->getGroup('interest');
$this->smarty->assign('fields', $fields);
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:11,代码来源:connectionBackendFields.action.php
示例14: chooseAction
function chooseAction()
{
// TODO maybe? - prevent people from viewing this page if localization is not enabled
$default_locale = strtolower(Bolts_Registry::get('default_locale', 'default'));
$request = new Bolts_Request($this->getRequest());
// TODO - get cookie value and validate it
// TODO - only redirect if a valid cookie value exists !
if (!$request->has('change') && false) {
$this->_redirect("/" . $this->locale_code);
}
// Force the use of en-US
if ($this->locale_code != $default_locale) {
$this->locale_code = $default_locale;
$this->_redirect("/" . $this->_request->getModuleName() . "/" . $this->_request->getControllerName() . "/" . $this->_request->getActionName() . "/");
}
$locales_table = new Locales();
$tmp_regions = $locales_table->getDistinctRegions();
$choices = array();
foreach ($tmp_regions as $tmp_region) {
if ($tmp_region['region_name'] == 'Global') {
continue;
}
$tmp_countries = $locales_table->getDistinctCountries($tmp_region['region_name']);
$tmp_pseudo_countries = $locales_table->getDistinctPseudoCountryCodes($tmp_region['region_name']);
foreach ($tmp_countries as $tmp_country) {
if (!empty($tmp_pseudo_countries) && in_array($tmp_country['country_code'], $tmp_pseudo_countries[0])) {
continue;
}
$tmp_lang = $locales_table->getLanguages($tmp_region['region_name'], $tmp_country['country_code']);
$tmp_country['languages'] = array();
foreach ($tmp_lang as $lan) {
if (!is_null($lan['pseudo_country_code'])) {
$tmp_locale_code = strtolower($lan['language_code'] . "-" . $lan['pseudo_country_code']);
} else {
$tmp_locale_code = strtolower($lan['language_code'] . "-" . $tmp_country['country_code']);
}
if (in_array($tmp_locale_code, $this->live_locales)) {
$tmp_country['languages'][] = $lan;
}
}
if (count($tmp_country['languages']) > 0) {
$tmp_region['countries'][] = $tmp_country;
}
}
if (array_key_exists('countries', $tmp_region) && count($tmp_region['countries']) > 0) {
$choices[] = $tmp_region;
}
}
$this->view->choices = $choices;
if ($request->has('inline')) {
$this->view->inline = $request->inline;
}
}
开发者ID:jaybill,项目名称:Bolts,代码行数:53,代码来源:LocaleController.php
示例15: execute
function execute()
{
$locale = new Locales('connection');
$list = $locale->getList();
$this->smarty->assign('lang', $list);
$model = new connectionCountryModel();
$countries = array();
foreach ($list as $lang) {
$countries[$lang['iso']] = $model->getList($lang['iso']);
}
$this->smarty->assign('country', $countries);
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:12,代码来源:connectionBackendCountry.action.php
示例16: execute
function execute()
{
$page_id = Request::post('page_id');
if (!$page_id) {
exit;
}
$model = new connectionPagesModel();
$locale = new Locales('connection');
$list = $locale->getList();
$this->smarty->assign('lang', $list);
$this->smarty->assign('page', $model->getPage($page_id));
$this->smarty->display(APP_DIR . DS . App::getAppName() . DS . APP_TEMPLATES_DIR . DS . 'backend' . DS . '/include/modal/pageEdite.html');
exit;
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:14,代码来源:connectionPagesEdite.action.php
示例17: hasVariant
public function hasVariant($id, $variant)
{
$locale = new Locales('connection');
$list = $locale->getList();
$where = array('id' => (int) $id);
foreach ($list as $value) {
$where['$or'][] = array($value['iso'] . '.variant' => $variant);
}
$result = $this->where($where)->fetchAll();
if (sizeof($result) > 0) {
return true;
}
return false;
}
开发者ID:Yogurt933,项目名称:Made-Easy,代码行数:14,代码来源:connectionFields.model.php
示例18: getDateFormatted
/**
* shortuct for formatting the date in the same way that it is expected by
* the "date picker" javascript calendar
*
*�@return a string
*/
function getDateFormatted()
{
include_once PLOG_CLASS_PATH . "class/locale/locales.class.php";
$locale = Locales::getLocale("en_UK");
$dateFormatted = $locale->formatDate($this->getDateObject(), "%d/%m/%Y %H:%M");
return $dateFormatted;
}
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:13,代码来源:customfielddatevalue.class.php
示例19: _matchHttpAcceptLanguages
/**
* Tries to match the prefered language out of the http_accept_language string
* with one of the available languages.
*
* @private
* @param httpAcceptLanguage the value of $_SERVER['HTTP_ACCEPT_LANGUAGE']
* @return Returns returns prefered language or false if no language matched.
*/
function _matchHttpAcceptLanguages(&$httpAcceptLanguage)
{
$acceptedLanguages = explode(',', $httpAcceptLanguage);
$availableLanguages =& Locales::getAvailableLocales();
$primaryLanguageMatch = '';
// we iterate through the array of languages sent by the UA and test every single
// one against the array of available languages
foreach ($acceptedLanguages as $acceptedLang) {
// clean the string and strip it down to the language value (remove stuff like ";q=0.3")
$acceptedLang = substr($acceptedLang, 0, strcspn($acceptedLang, ';'));
if (strlen($acceptedLang) > 2) {
// cut to primary language
$primaryAcceptedLang = substr($acceptedLang, 0, 2);
} else {
$primaryAcceptedLang = $acceptedLang;
}
// this is where we start to iterate through available languages
foreach ($availableLanguages as $availableLang) {
if (stristr($availableLang, $acceptedLang) !== false) {
// we have a exact language match
return $availableLang;
} elseif (stristr($availableLang, $primaryAcceptedLang) !== false && $primaryLanguageMatch == '') {
// we found the first primary language match!
$primaryLanguageMatch = $availableLang;
}
}
}
// foreach
if ($primaryLanguageMatch != '') {
return $primaryLanguageMatch;
} else {
return false;
}
}
开发者ID:BackupTheBerlios,项目名称:plogfr-svn,代码行数:42,代码来源:summaryaction.class.php
示例20: load
/**
* Reload the REST information.
* This is only a empty placeholder. The child class can override it.
*
* @author David Pauli <[email protected]>
* @since 0.0.0
* @since 0.0.1 Use HTTPRequestMethod enum.
* @since 0.1.0 Use a default Locale.
* @since 0.1.1 Unstatic every attributes.
*/
private function load()
{
// if the REST path empty -> this is the not the implementation or can't get something else
if (InputValidator::isEmpty(self::RESTPATH) || !RESTClient::setRequestMethod(HTTPRequestMethod::GET)) {
return;
}
$content = RESTClient::sendWithLocalization(self::RESTPATH, Locales::getLocale());
// if respond is empty
if (InputValidator::isEmpty($content)) {
return;
}
// reset values
$this->resetValues();
if (!InputValidator::isEmptyArrayKey($content, "name")) {
$this->NAME = $content["name"];
}
if (!InputValidator::isEmptyArrayKey($content, "navigationCaption")) {
$this->NAVIGATIONCAPTION = $content["navigationCaption"];
}
if (!InputValidator::isEmptyArrayKey($content, "description")) {
$this->DESCRIPTION = $content["description"];
}
// update timestamp when make the next request
$timestamp = (int) (microtime(true) * 1000);
$this->NEXT_REQUEST_TIMESTAMP = $timestamp + RESTClient::$NEXT_RESPONSE_WAIT_TIME;
}
开发者ID:Quaese,项目名称:ep6client-php,代码行数:36,代码来源:InformationTrait.class.php
注:本文中的Locales类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论