本文整理汇总了PHP中Locales类的典型用法代码示例。如果您正苦于以下问题:PHP Locales类的具体用法?PHP Locales怎么用?PHP Locales使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Locales类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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("/");
}
}
}
示例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());
}
示例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;
}
示例4: render
function render()
{
// load all the locale files
$locales = new Locales();
$siteLocales = $locales->getLocales();
$this->setValue("locales", $siteLocales);
parent::render();
}
示例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);
}
示例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);
}
示例7: Locales
public function &GetLocales()
{
if (!isset($this->_locales)) {
$locales = new Locales();
$locales->LoadAll();
$this->_locales = $locales;
}
return $this->_locales;
}
示例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'));
}
示例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));
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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;
}
}
示例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);
}