当前位置: 首页>>代码示例>>PHP>>正文


PHP Locale::getAllLocales方法代码示例

本文整理汇总了PHP中Locale::getAllLocales方法的典型用法代码示例。如果您正苦于以下问题:PHP Locale::getAllLocales方法的具体用法?PHP Locale::getAllLocales怎么用?PHP Locale::getAllLocales使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Locale的用法示例。


在下文中一共展示了Locale::getAllLocales方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: languages

 /**
  * Display form to modify site language settings.
  * @param $args array
  * @param $request object
  */
 function languages($args, &$request)
 {
     $this->validate();
     $this->setupTemplate(true);
     $site =& $request->getSite();
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('localeNames', Locale::getAllLocales());
     $templateMgr->assign('primaryLocale', $site->getPrimaryLocale());
     $templateMgr->assign('supportedLocales', $site->getSupportedLocales());
     $localesComplete = array();
     foreach (Locale::getAllLocales() as $key => $name) {
         $localesComplete[$key] = Locale::isLocaleComplete($key);
     }
     $templateMgr->assign('localesComplete', $localesComplete);
     $templateMgr->assign('installedLocales', $site->getInstalledLocales());
     $templateMgr->assign('uninstalledLocales', array_diff(array_keys(Locale::getAllLocales()), $site->getInstalledLocales()));
     $templateMgr->assign('helpTopicId', 'site.siteManagement');
     import('classes.i18n.LanguageAction');
     $languageAction = new LanguageAction();
     if ($languageAction->isDownloadAvailable()) {
         $templateMgr->assign('downloadAvailable', true);
         $templateMgr->assign('downloadableLocales', $languageAction->getDownloadableLocales());
     }
     $templateMgr->display('admin/languages.tpl');
 }
开发者ID:jerico-dev,项目名称:omp,代码行数:30,代码来源:AdminLanguagesHandler.inc.php

示例2: compileLocales

 function compileLocales()
 {
     $locales =& Locale::getAllLocales();
     foreach ($locales as $key => $name) {
         Locale::loadLocale($key);
     }
 }
开发者ID:LiteratimBi,项目名称:jupitertfn,代码行数:7,代码来源:preCompile.php

示例3: InstallForm

 /**
  * Constructor.
  */
 function InstallForm()
 {
     parent::Form('install/install.tpl');
     // FIXME Move the below options to an external configuration file?
     $this->supportedLocales = Locale::getAllLocales();
     $this->supportedClientCharsets = array('utf-8' => 'Unicode (UTF-8)', 'iso-8859-1' => 'Western (ISO-8859-1)');
     $this->supportedConnectionCharsets = array('' => Locale::translate('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)');
     $this->supportedDatabaseCharsets = array('' => Locale::translate('common.notApplicable'), 'utf8' => 'Unicode (UTF-8)');
     $this->supportedEncryptionAlgorithms = array('md5' => 'MD5');
     if (function_exists('sha1')) {
         $this->supportedEncryptionAlgorithms['sha1'] = 'SHA1';
     }
     $this->supportedDatabaseDrivers = array('mysql' => array('mysql', 'MySQL'), 'postgres' => array('pgsql', 'PostgreSQL'), 'oracle' => array('oci8', 'Oracle'), 'mssql' => array('mssql', 'MS SQL Server'), 'fbsql' => array('fbsql', 'FrontBase'), 'ibase' => array('ibase', 'Interbase'), 'firebird' => array('ibase', 'Firebird'), 'informix' => array('ifx', 'Informix'), 'sybase' => array('sybase', 'Sybase'), 'odbc' => array('odbc', 'ODBC'));
     // Validation checks for this form
     $this->addCheck(new FormValidatorInSet($this, 'locale', 'required', 'installer.form.localeRequired', array_keys($this->supportedLocales)));
     $this->addCheck(new FormValidatorCustom($this, 'locale', 'required', 'installer.form.localeRequired', array('Locale', 'isLocaleValid')));
     $this->addCheck(new FormValidatorInSet($this, 'clientCharset', 'required', 'installer.form.clientCharsetRequired', array_keys($this->supportedClientCharsets)));
     $this->addCheck(new FormValidator($this, 'filesDir', 'required', 'installer.form.filesDirRequired'));
     $this->addCheck(new FormValidatorInSet($this, 'encryption', 'required', 'installer.form.encryptionRequired', array_keys($this->supportedEncryptionAlgorithms)));
     $this->addCheck(new FormValidator($this, 'adminUsername', 'required', 'installer.form.usernameRequired'));
     // Opatan Inc. : FormValidatorAlphaNum for username is removed
     // Opatan Inc. : Email Validator for admin username is added && email validator is removed
     $this->addCheck(new FormValidatorEmail($this, 'adminUsername', 'required', 'installer.form.adminEmailRequired'));
     $this->addCheck(new FormValidator($this, 'adminPassword', 'required', 'installer.form.passwordRequired'));
     $this->addCheck(new FormValidatorCustom($this, 'adminPassword', 'required', 'installer.form.passwordsDoNotMatch', create_function('$password,$form', 'return $password == $form->getData(\'adminPassword2\');'), array(&$this)));
     $this->addCheck(new FormValidatorInSet($this, 'databaseDriver', 'required', 'installer.form.databaseDriverRequired', array_keys($this->supportedDatabaseDrivers)));
     $this->addCheck(new FormValidator($this, 'databaseName', 'required', 'installer.form.databaseNameRequired'));
     $this->addCheck(new FormValidatorPost($this));
 }
开发者ID:alenoosh,项目名称:ojs,代码行数:32,代码来源:InstallForm.inc.php

示例4: display

 /**
  * Display the form.
  */
 function display()
 {
     $conference =& Request::getConference();
     $schedConf =& Request::getSchedConf();
     $user =& Request::getUser();
     $templateMgr =& TemplateManager::getManager();
     // Get tracks for this conference
     $trackDao =& DAORegistry::getDAO('TrackDAO');
     // If this user is a track director or a director, they are
     // allowed to submit to tracks flagged as "director-only" for
     // submissions. Otherwise, display only tracks they are allowed
     // to submit to.
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $isDirector = $roleDao->userHasRole($conference->getId(), $schedConf->getId(), $user->getId(), ROLE_ID_DIRECTOR) || $roleDao->userHasRole($conference->getId(), $schedConf->getId(), $user->getId(), ROLE_ID_TRACK_DIRECTOR) || $roleDao->userHasRole($conference->getId(), 0, $user->getId(), ROLE_ID_DIRECTOR) || $roleDao->userHasRole($conference->getId(), 0, $user->getId(), ROLE_ID_TRACK_DIRECTOR);
     $templateMgr->assign('trackOptions', array('0' => Locale::translate('author.submit.selectTrack')) + $trackDao->getTrackTitles($schedConf->getId(), !$isDirector));
     $paperTypeDao =& DAORegistry::getDAO('PaperTypeDAO');
     $sessionTypes = $paperTypeDao->getPaperTypes($schedConf->getId());
     $templateMgr->assign('sessionTypes', $sessionTypes->toArray());
     // Provide available submission languages. (Convert the array
     // of locale symbolic names xx_XX into an associative array
     // of symbolic names => readable names.)
     $supportedSubmissionLocales = $conference->getSetting('supportedSubmissionLocales');
     if (empty($supportedSubmissionLocales)) {
         $supportedSubmissionLocales = array($conference->getPrimaryLocale());
     }
     $templateMgr->assign('supportedSubmissionLocaleNames', array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales)));
     parent::display();
 }
开发者ID:ramonsodoma,项目名称:ocs,代码行数:31,代码来源:AuthorSubmitStep1Form.inc.php

示例5: display

 /**
  * Display the form.
  */
 function display()
 {
     $press =& Request::getPress();
     $user =& Request::getUser();
     $templateMgr =& TemplateManager::getManager();
     // Get series for this press
     $seriesDao =& DAORegistry::getDAO('SeriesDAO');
     // FIXME: If this user is a series editor or an editor, they are
     // allowed to submit to series flagged as "editor-only" for
     // submissions. Otherwise, display only series they are allowed
     // to submit to.
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $isEditor = $roleDao->userHasRole($press->getId(), $user->getId(), ROLE_ID_EDITOR) || $roleDao->userHasRole($press->getId(), $user->getId(), ROLE_ID_SERIES_EDITOR);
     $seriesOptions = array('0' => Locale::translate('submission.submit.selectSeries')) + $seriesDao->getTitlesByPressId($press->getId());
     $templateMgr->assign('seriesOptions', $seriesOptions);
     // Provide available submission languages. (Convert the array
     // of locale symbolic names xx_XX into an associative array
     // of symbolic names => readable names.)
     $supportedSubmissionLocales = $press->getSetting('supportedSubmissionLocales');
     if (empty($supportedSubmissionLocales)) {
         $supportedSubmissionLocales = array($press->getPrimaryLocale());
     }
     $templateMgr->assign('supportedSubmissionLocaleNames', array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales)));
     parent::display();
 }
开发者ID:ramonsodoma,项目名称:omp,代码行数:28,代码来源:SubmissionSubmitStep1Form.inc.php

示例6: execute

 /**
  * Test locales.
  */
 function execute()
 {
     // Flush the file cache just to be certain we're using
     // the most recent stuff
     import('cache.CacheManager');
     $cacheManager =& CacheManager::getManager();
     $cacheManager->flush('locale');
     // Load plugins so that their locale data is included too
     $plugins = array();
     foreach (PluginRegistry::getCategories() as $category) {
         echo "Loading plugin category \"{$category}\"...\n";
         $morePlugins = PluginRegistry::loadCategory($category);
         if (is_array($morePlugins)) {
             $plugins += $morePlugins;
         }
     }
     foreach (Locale::getAllLocales() as $locale => $name) {
         if (!empty($this->locales) && !in_array($locale, $this->locales)) {
             continue;
         }
         if ($locale != MASTER_LOCALE) {
             echo "Testing locale \"{$name}\" ({$locale}) against reference locale " . MASTER_LOCALE . ".\n";
             $this->testLocale($locale, MASTER_LOCALE, $plugins);
             $this->testEmails($locale, MASTER_LOCALE);
         }
     }
 }
开发者ID:jalperin,项目名称:harvester,代码行数:30,代码来源:localeCheck.php

示例7: getMessage

 /**
  * Get the error message associated with a failed validation check.
  * @see FormValidator::getMessage()
  * @return string
  */
 function getMessage()
 {
     $primaryLocale = Locale::getPrimaryLocale();
     $allLocales = Locale::getAllLocales();
     //return parent::getMessage() . ' (' . $allLocales[$this->_requiredLocale] . ')';
     return parent::getMessage();
     //Edited by Anne Ivy Mirasol, April 27, 2011
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:13,代码来源:FormValidatorLocale.inc.php

示例8: lockss

 function lockss($args, $request)
 {
     $this->validate();
     $this->setupTemplate();
     $journal =& $request->getJournal();
     $templateMgr =& TemplateManager::getManager();
     if ($journal != null) {
         if (!$journal->getSetting('enableLockss')) {
             $request->redirect(null, 'index');
         }
         $year = $request->getUserVar('year');
         $issueDao =& DAORegistry::getDAO('IssueDAO');
         // FIXME Should probably go in IssueDAO or a subclass
         if (isset($year)) {
             $year = (int) $year;
             $result =& $issueDao->retrieve('SELECT * FROM issues WHERE journal_id = ? AND year = ? AND published = 1 ORDER BY current DESC, year ASC, volume ASC, number ASC', array($journal->getId(), $year));
             if ($result->RecordCount() == 0) {
                 unset($year);
             }
         }
         if (!isset($year)) {
             $showInfo = true;
             $result =& $issueDao->retrieve('SELECT MAX(year) FROM issues WHERE journal_id = ? AND published = 1', $journal->getId());
             list($year) = $result->fields;
             $result =& $issueDao->retrieve('SELECT * FROM issues WHERE journal_id = ? AND year = ? AND published = 1 ORDER BY current DESC, year ASC, volume ASC, number ASC', array($journal->getId(), $year));
         } else {
             $showInfo = false;
         }
         $issues = new DAOResultFactory($result, $issueDao, '_returnIssueFromRow');
         $prevYear = null;
         $nextYear = null;
         if (isset($year)) {
             $result =& $issueDao->retrieve('SELECT MAX(year) FROM issues WHERE journal_id = ? AND published = 1 AND year < ?', array($journal->getId(), $year));
             list($prevYear) = $result->fields;
             $result =& $issueDao->retrieve('SELECT MIN(year) FROM issues WHERE journal_id = ? AND published = 1 AND year > ?', array($journal->getId(), $year));
             list($nextYear) = $result->fields;
         }
         $templateMgr->assign_by_ref('journal', $journal);
         $templateMgr->assign_by_ref('issues', $issues);
         $templateMgr->assign('year', $year);
         $templateMgr->assign('prevYear', $prevYear);
         $templateMgr->assign('nextYear', $nextYear);
         $templateMgr->assign('showInfo', $showInfo);
         $locales =& $journal->getSupportedLocaleNames();
         if (!isset($locales) || empty($locales)) {
             $localeNames =& Locale::getAllLocales();
             $primaryLocale = Locale::getPrimaryLocale();
             $locales = array($primaryLocale => $localeNames[$primaryLocale]);
         }
         $templateMgr->assign_by_ref('locales', $locales);
     } else {
         $journalDao =& DAORegistry::getDAO('JournalDAO');
         $journals =& $journalDao->getJournals(true);
         $templateMgr->assign_by_ref('journals', $journals);
     }
     $templateMgr->display('gateway/lockss.tpl');
 }
开发者ID:ramonsodoma,项目名称:ojs,代码行数:57,代码来源:GatewayHandler.inc.php

示例9: getGalleyLabel

 /**
  * Get the localized value of the galley label.
  * @return $string
  */
 function getGalleyLabel()
 {
     $label = $this->getLabel();
     if ($this->getLocale() != Locale::getLocale()) {
         $locales = Locale::getAllLocales();
         $label .= ' (' . $locales[$this->getLocale()] . ')';
     }
     return $label;
 }
开发者ID:ramonsodoma,项目名称:ojs,代码行数:13,代码来源:IssueGalley.inc.php

示例10: index

 function index()
 {
     list($plugin) = TranslatorHandler::validate();
     TranslatorHandler::setupTemplate(false);
     $rangeInfo = Handler::getRangeInfo('locales');
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('locales', new ArrayItemIterator(Locale::getAllLocales(), $rangeInfo->getPage(), $rangeInfo->getCount()));
     $templateMgr->assign('masterLocale', MASTER_LOCALE);
     $templateMgr->display($plugin->getTemplatePath() . 'index.tpl');
 }
开发者ID:alenoosh,项目名称:ojs,代码行数:10,代码来源:TranslatorHandler.inc.php

示例11: WithdrawForm

 /**
  * Constructor.
  * @param $article object
  */
 function WithdrawForm($article, $journal)
 {
     $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales');
     if (empty($supportedSubmissionLocales)) {
         $supportedSubmissionLocales = array($journal->getPrimaryLocale());
     }
     parent::Form('submission/suppFile/withdraw.tpl', true, $article->getLocale(), array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales)));
     $this->article = $article;
     $this->addCheck(new FormValidator($this, 'withdrawReason', 'required', 'author.submit.form.withdrawReasonRequired'));
     $this->addCheck(new FormValidator($this, 'otherReason', 'required', 'author.submit.form.otherReasonRequired'));
 }
开发者ID:JovanyJeff,项目名称:hrp,代码行数:15,代码来源:WithdrawForm.inc.php

示例12: getSupportedLocales

 /**
  * Get all supported locales for the current context.
  * @return array
  */
 function getSupportedLocales()
 {
     static $supportedLocales;
     if (!isset($supportedLocales)) {
         if (defined('SESSION_DISABLE_INIT') || !Config::getVar('general', 'installed')) {
             $supportedLocales = Locale::getAllLocales();
         } else {
             $site =& Request::getSite();
             $supportedLocales = $site->getSupportedLocaleNames();
         }
     }
     return $supportedLocales;
 }
开发者ID:ramonsodoma,项目名称:harvester,代码行数:17,代码来源:Locale.inc.php

示例13: MetadataForm

 /**
  * Constructor.
  */
 function MetadataForm($article, $journal)
 {
     $roleDao =& DAORegistry::getDAO('RoleDAO');
     $signoffDao =& DAORegistry::getDAO('SignoffDAO');
     $user =& Request::getUser();
     $roleId = $roleDao->getRoleIdFromPath(Request::getRequestedPage());
     // If the user is an editor of this article, make the entire form editable.
     $this->canEdit = false;
     $this->isEditor = false;
     if ($roleId != null && ($roleId == ROLE_ID_EDITOR || $roleId == ROLE_ID_SECTION_EDITOR)) {
         $this->canEdit = true;
         $this->isEditor = true;
     }
     $copyeditInitialSignoff = $signoffDao->getBySymbolic('SIGNOFF_COPYEDITING_INITIAL', ASSOC_TYPE_ARTICLE, $article->getId());
     // If the user is an author and the article hasn't passed the Copyediting stage, make the form editable.
     if ($roleId == ROLE_ID_AUTHOR) {
         if ($article->getStatus() != STATUS_PUBLISHED && ($copyeditInitialSignoff == null || $copyeditInitialSignoff->getDateCompleted() == null)) {
             $this->canEdit = true;
         }
     }
     // Copy editors are also allowed to edit metadata, but only if they have
     // a current assignment to the article.
     if ($roleId != null && $roleId == ROLE_ID_COPYEDITOR) {
         $copyeditFinalSignoff = $signoffDao->build('SIGNOFF_COPYEDITING_FINAL', ASSOC_TYPE_ARTICLE, $article->getId());
         if ($copyeditFinalSignoff != null && $article->getStatus() != STATUS_PUBLISHED) {
             if ($copyeditInitialSignoff->getDateNotified() != null && $copyeditFinalSignoff->getDateCompleted() == null) {
                 $this->canEdit = true;
             }
         }
     }
     if ($this->canEdit) {
         $supportedSubmissionLocales = $journal->getSetting('supportedSubmissionLocales');
         if (empty($supportedSubmissionLocales)) {
             $supportedSubmissionLocales = array($journal->getPrimaryLocale());
         }
         parent::Form('submission/metadata/metadataEdit.tpl', true, $article->getLocale(), array_flip(array_intersect(array_flip(Locale::getAllLocales()), $supportedSubmissionLocales)));
         $this->addCheck(new FormValidatorLocale($this, 'title', 'required', 'author.submit.form.titleRequired', $this->getRequiredLocale()));
         $this->addCheck(new FormValidatorArray($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', array('firstName', 'lastName')));
         $this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'author.submit.form.authorRequiredFields', create_function('$email, $regExp', 'return String::regexp_match($regExp, $email);'), array(ValidatorEmail::getRegexp()), false, array('email')));
         $this->addCheck(new FormValidatorArrayCustom($this, 'authors', 'required', 'user.profile.form.urlInvalid', create_function('$url, $regExp', 'return empty($url) ? true : String::regexp_match($regExp, $url);'), array(ValidatorUrl::getRegexp()), false, array('url')));
     } else {
         parent::Form('submission/metadata/metadataView.tpl');
     }
     // If the user is a reviewer of this article, do not show authors.
     $this->canViewAuthors = true;
     if ($roleId != null && $roleId == ROLE_ID_REVIEWER) {
         $this->canViewAuthors = false;
     }
     $this->article = $article;
     $this->addCheck(new FormValidatorPost($this));
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:54,代码来源:MetadataForm.inc.php

示例14: array

 /**
  * Return associative array of all locales supported by the site.
  * These locales are used to provide a language toggle on the main site pages.
  * @return array
  */
 function &getSupportedLocaleNames()
 {
     $supportedLocales =& Registry::get('siteSupportedLocales', true, null);
     if ($supportedLocales === null) {
         $supportedLocales = array();
         $localeNames =& Locale::getAllLocales();
         $locales = $this->getSupportedLocales();
         foreach ($locales as $localeKey) {
             $supportedLocales[$localeKey] = $localeNames[$localeKey];
         }
         asort($supportedLocales);
     }
     return $supportedLocales;
 }
开发者ID:master3395,项目名称:CBPPlatform,代码行数:19,代码来源:Site.inc.php

示例15: array

 /**
  * Return associative array of all locales supported by the site.
  * These locales are used to provide a language toggle on the main site pages.
  * @return array
  */
 function &getSupportedLocaleNames()
 {
     static $supportedLocales;
     if (!isset($supportedLocales)) {
         $supportedLocales = array();
         $localeNames =& Locale::getAllLocales();
         $locales = $this->getSupportedLocales();
         foreach ($locales as $localeKey) {
             $supportedLocales[$localeKey] = $localeNames[$localeKey];
         }
         asort($supportedLocales);
     }
     return $supportedLocales;
 }
开发者ID:alenoosh,项目名称:ojs,代码行数:19,代码来源:Site.inc.php


注:本文中的Locale::getAllLocales方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。