本文整理汇总了PHP中Locale::translate方法的典型用法代码示例。如果您正苦于以下问题:PHP Locale::translate方法的具体用法?PHP Locale::translate怎么用?PHP Locale::translate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locale
的用法示例。
在下文中一共展示了Locale::translate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display()
{
$journal = Request::getJournal();
$countryDao =& DAORegistry::getDAO('CountryDAO');
$extraFieldDao =& DAORegistry::getDAO('ExtraFieldDAO');
$institutionDao =& DAORegistry::getDAO('InstitutionDAO');
$currencyDao =& DAORegistry::getDAO('CurrencyDAO');
$sectionDao =& DAORegistry::getDAO('SectionDAO');
$sectionOptions = array('0' => Locale::translate('editor.reports.anyCommittee')) + $sectionDao->getSectionTitles($journal->getId());
$decisionTypes = array(INITIAL_REVIEW => 'submission.initialReview', PROGRESS_REPORT => 'submission.progressReport', PROTOCOL_AMENDMENT => 'submission.protocolAmendment', SERIOUS_ADVERSE_EVENT => 'submission.seriousAdverseEvents', FINAL_REPORT => 'submission.finalReport');
$decisionOptions = array(98 => 'editor.reports.aDecisionsIUR', 99 => 'editor.reports.aDecisionsEUR', SUBMISSION_SECTION_DECISION_APPROVED => 'editor.article.decision.approved', SUBMISSION_SECTION_DECISION_RESUBMIT => 'editor.article.decision.resubmit', SUBMISSION_SECTION_DECISION_DECLINED => 'editor.article.decision.declined');
$budgetOptions = array(">=" => 'editor.reports.budgetSuperiorTo', "<=" => 'editor.reports.budgetInferiorTo');
$sourceCurrencyId = $journal->getSetting('sourceCurrency');
$reportTypeOptions = array(0 => 'editor.reports.type.spreadsheet', 1 => 'editor.reports.type.pieChart', 2 => 'editor.reports.type.barChart');
$measurementOptions = array(0 => 'editor.reports.measurement.proposalNmbre', 1 => 'editor.reports.measurement.cumulatedBudget');
$chartOptions = array();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign('sectionOptions', $sectionOptions);
$templateMgr->assign('decisionTypes', $decisionTypes);
$templateMgr->assign('decisionOptions', $decisionOptions);
$templateMgr->assign('institutionsList', $institutionDao->getInstitutionsList());
$templateMgr->assign('reportTypeOptions', $reportTypeOptions);
$templateMgr->assign('measurementOptions', $measurementOptions);
$templateMgr->assign('chartOptions', $chartOptions);
parent::display();
}
示例2: InstitutionalSubscriptionForm
/**
* Constructor
* @param subscriptionId int leave as default for new subscription
*/
function InstitutionalSubscriptionForm($subscriptionId = null, $userId = null)
{
parent::Form('subscription/institutionalSubscriptionForm.tpl');
parent::SubscriptionForm($subscriptionId, $userId);
$subscriptionId = isset($subscriptionId) ? (int) $subscriptionId : null;
$userId = isset($userId) ? (int) $userId : null;
$journal =& Request::getJournal();
$journalId = $journal->getId();
if (isset($subscriptionId)) {
$subscriptionDao =& DAORegistry::getDAO('InstitutionalSubscriptionDAO');
if ($subscriptionDao->subscriptionExists($subscriptionId)) {
$this->subscription =& $subscriptionDao->getSubscription($subscriptionId);
}
}
$subscriptionTypeDao =& DAORegistry::getDAO('SubscriptionTypeDAO');
$subscriptionTypes =& $subscriptionTypeDao->getSubscriptionTypesByInstitutional($journalId, true);
$this->subscriptionTypes =& $subscriptionTypes->toArray();
$subscriptionTypeCount = count($this->subscriptionTypes);
if ($subscriptionTypeCount == 0) {
$this->addError('typeId', Locale::translate('manager.subscriptions.form.typeRequired'));
$this->addErrorField('typeId');
}
// Ensure subscription type is valid
$this->addCheck(new FormValidatorCustom($this, 'typeId', 'required', 'manager.subscriptions.form.typeIdValid', create_function('$typeId, $journalId', '$subscriptionTypeDao =& DAORegistry::getDAO(\'SubscriptionTypeDAO\'); return ($subscriptionTypeDao->subscriptionTypeExistsByTypeId($typeId, $journalId) && $subscriptionTypeDao->getSubscriptionTypeInstitutional($typeId) == 1);'), array($journal->getId())));
// Ensure institution name is provided
$this->addCheck(new FormValidator($this, 'institutionName', 'required', 'manager.subscriptions.form.institutionNameRequired'));
// If provided, domain is valid
$this->addCheck(new FormValidatorRegExp($this, 'domain', 'optional', 'manager.subscriptions.form.domainValid', '/^' . '[A-Z0-9]+([\\-_\\.][A-Z0-9]+)*' . '\\.' . '[A-Z]{2,4}' . '$/i'));
}
示例3: display
/**
* Display the form.
*/
function display()
{
$press =& Request::getPress();
$user =& Request::getUser();
$submission = $this->reviewerSubmission;
$reviewFormResponseDao =& DAORegistry::getDAO('ReviewFormResponseDAO');
$reviewAssignmentDao =& DAORegistry::getDAO('ReviewAssignmentDAO');
$reviewAssignment = $reviewAssignmentDao->getById($submission->getReviewId());
if ($submission->getDateConfirmed() == null) {
$confirmedStatus = 0;
} else {
$confirmedStatus = 1;
}
$templateMgr =& TemplateManager::getManager();
$reviewerRequestParams = array('reviewer' => $reviewAssignment->getReviewerFullName(), 'personalNote' => 'EDITOR NOTE', 'editor' => $press->getSetting('contactName'));
$templateMgr->assign('reviewerRequest', Locale::translate('reviewer.step1.requestBoilerplate', $reviewerRequestParams));
$templateMgr->assign_by_ref('submission', $submission);
$templateMgr->assign_by_ref('reviewAssignment', $reviewAssignment);
$templateMgr->assign_by_ref('press', $press);
$templateMgr->assign_by_ref('reviewGuidelines', $press->getLocalizedSetting('reviewGuidelines'));
$templateMgr->assign('step', 1);
$templateMgr->assign('completedSteps', $submission->getStatus());
$templateMgr->assign('blindReview', true);
// FIXME: Need to be able to get/set if a review is blind or not
// FIXME: Need press setting that denotes competing interests are required
$templateMgr->assign('competingInterestsText', $submission->getCompetingInterests());
import('classes.submission.reviewAssignment.ReviewAssignment');
$templateMgr->assign_by_ref('reviewerRecommendationOptions', ReviewAssignment::getReviewerRecommendationOptions());
$templateMgr->assign('helpTopicId', 'editorial.reviewersRole.review');
parent::display();
}
示例4: getTemplateVarsFromRowColumn
/**
* Extracts variables for a given column from a data element
* so that they may be assigned to template before rendering.
* @param $row GridRow
* @param $column GridColumn
* @return array
*/
function getTemplateVarsFromRowColumn(&$row, $column)
{
$monographFile =& $row->getData();
$columnId = $column->getId();
assert(is_a($monographFile, 'DataObject') && !empty($columnId));
switch ($columnId) {
case 'name':
$fileName = $monographFile->getLocalizedName() != '' ? $monographFile->getLocalizedName() : Locale::translate('common.untitled');
if ($monographFile->getRevision() > 1) {
$fileName .= ' (' . $monographFile->getRevision() . ')';
}
// Add revision number to label
if (empty($title)) {
$title = Locale::translate('common.untitled');
}
return array('label' => $fileName);
break;
case 'fileType':
return array('label' => $monographFile->getExtension());
break;
case 'type':
$genreDao =& DAORegistry::getDAO('GenreDAO');
$genre = $genreDao->getById($monographFile->getGenreId());
return array('label' => $genre->getLocalizedName());
break;
}
}
示例5: 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();
}
示例6: 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();
}
示例7: display
/**
* Display the form.
*/
function display()
{
$templateMgr =& TemplateManager::getManager();
$institutionDao =& DAORegistry::getDAO('InstitutionDAO');
$sectionDao =& DAORegistry::getDAO('SectionDAO');
$countInstitutions = count($institutionDao->getGeoAreas($this->extraFieldId));
$countCommittees = count($sectionDao->getGeoAreas($this->extraFieldId));
if ($this->typeConst == EXTRA_FIELD_GEO_AREA) {
if ($this->extraFieldId && ($countInstitutions > 0 || $countCommittees > 0)) {
$warning = 'manager.extraFields.geoAreas.modify.warning';
} else {
$warning = null;
}
} else {
if ($this->extraFieldId) {
$warning = 'manager.extraFields.modify.warning';
} else {
$warning = null;
}
}
$templateMgr->assign('warning', $warning);
$templateMgr->assign('yesNoArray', array(EXTRA_FIELD_ACTIVE => Locale::translate('common.yes'), EXTRA_FIELD_NOT_ACTIVE => Locale::translate('common.no')));
$templateMgr->assign('pageTitle', 'manager.extraFields.' . $this->type . '.edit');
$templateMgr->assign('extraFieldId', $this->extraFieldId);
$templateMgr->assign('type', $this->type);
$journal = Request::getJournal();
$templateMgr->assign_by_ref('locales', $journal->getSupportedLocaleNames());
parent::display();
}
示例8: putHeaders
private function putHeaders(&$columns)
{
$columns = array('track' => Locale::translate('track.title'), 'title' => Locale::translate('paper.title'), 'abstract' => Locale::translate('paper.abstract'));
for ($i = 0; $i <= $this->maxAuthors; $i++) {
$columns = array_merge($columns, array('fname' . $i => Locale::translate('user.firstName') . " (" . Locale::translate('user.role.author') . " {$i})", 'mname' . $i => Locale::translate('user.middleName') . " (" . Locale::translate('user.role.author') . " {$i})", 'lname' . $i => Locale::translate('user.lastName') . " (" . Locale::translate('user.role.author') . " {$i})", 'affiliation' . $i => Locale::translate('user.affiliation') . " (" . Locale::translate('user.role.author') . " {$i})", 'email' . $i => Locale::translate('user.email') . " (" . Locale::translate('user.role.author') . " {$i})"));
}
}
示例9: display
function display(&$args)
{
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
Locale::requireComponents(array(LOCALE_COMPONENT_APPLICATION_COMMON, LOCALE_COMPONENT_PKP_SUBMISSION, LOCALE_COMPONENT_PKP_USER, LOCALE_COMPONENT_OCS_MANAGER));
$this->import('PaperFormSettings');
$form = new PaperFormSettings($this, $conference->getId());
if (Request::getUserVar('GenerateReport')) {
$ReportHandlerDAO =& DAORegistry::getDAO('MultiPaperReportDAO');
$iterator =& $ReportHandlerDAO->getPaperReport($conference->getId(), $schedConf->getId());
$form->readInputData();
if ($form->validate()) {
$form->execute();
$custom_Class = $form->getData('reportClass');
if (class_exists($custom_Class)) {
$Report = new $custom_Class($iterator, $this);
$Report->makeReport();
Request::redirect(null, null, 'manager', 'plugin');
} else {
echo Locale::translate('plugins.reports.MultiGeneratorPaperReport.classNotFound');
$form->display();
}
} else {
$this->setBreadCrumbs(true);
$form->makeOptions();
$form->display();
}
} else {
$this->setBreadCrumbs(true);
$form->initData();
$form->display();
}
}
示例10: getTemplateVarsFromRowColumn
/**
* This implementation assumes an element that is a
* Filter. It will display the filter name and information
* about filter parameters (if any).
* @see GridCellProvider::getTemplateVarsFromRowColumn()
* @param $row GridRow
* @param $column GridColumn
* @return array
*/
function getTemplateVarsFromRowColumn(&$row, $column)
{
$filter =& $row->getData();
assert(is_a($filter, 'Filter'));
switch ($column->getId()) {
case 'settings':
$label = '';
foreach ($filter->getSettings() as $filterSetting) {
$settingData = $filter->getData($filterSetting->getName());
if (is_a($filterSetting, 'BooleanFilterSetting')) {
if ($settingData) {
if (!empty($label)) {
$label .= ' | ';
}
$label .= Locale::translate($filterSetting->getDisplayName());
}
} else {
if (!empty($settingData)) {
if (!empty($label)) {
$label .= ' | ';
}
$label .= Locale::translate($filterSetting->getDisplayName()) . ': ' . $settingData;
}
}
}
break;
default:
$label = $filter->getData($column->getId());
}
return array('label' => $label);
}
示例11: readParams
/**
* Read installation parameters from stdin.
* FIXME: May want to implement an abstract "CLIForm" class handling input/validation.
* FIXME: Use readline if available?
*/
function readParams()
{
printf("%s\n", Locale::translate('installer.ojsInstallation'));
parent::readParams();
$this->readParamBoolean('install', 'installer.installOJS');
return $this->params['install'];
}
示例12: displayPaymentForm
function displayPaymentForm($queuedPaymentId, &$queuedPayment)
{
if (!$this->isConfigured()) {
return false;
}
$journal =& Request::getJournal();
$templateMgr =& TemplateManager::getManager();
$user =& Request::getUser();
$templateMgr->assign('itemName', $queuedPayment->getName());
$templateMgr->assign('itemDescription', $queuedPayment->getDescription());
if ($queuedPayment->getAmount() > 0) {
$templateMgr->assign('itemAmount', $queuedPayment->getAmount());
$templateMgr->assign('itemCurrencyCode', $queuedPayment->getCurrencyCode());
}
$templateMgr->assign('manualInstructions', $this->getSetting($journal->getJournalId(), 'manualInstructions'));
$templateMgr->display($this->getTemplatePath() . 'paymentForm.tpl');
if ($queuedPayment->getAmount() > 0) {
import('mail.MailTemplate');
$contactName = $journal->getSetting('contactName');
$contactEmail = $journal->getSetting('contactEmail');
$mail =& new MailTemplate('MANUAL_PAYMENT_NOTIFICATION');
$mail->setFrom($contactEmail, $contactName);
$mail->addRecipient($contactEmail, $contactName);
$mail->assignParams(array('journalName' => $journal->getJournalTitle(), 'userFullName' => $user ? $user->getFullName() : '(' . Locale::translate('common.none') . ')', 'userName' => $user ? $user->getUsername() : '(' . Locale::translate('common.none') . ')', 'itemName' => $queuedPayment->getName(), 'itemCost' => $queuedPayment->getAmount(), 'itemCurrencyCode' => $queuedPayment->getCurrencyCode()));
$mail->send();
}
}
示例13: getHTMLContents
/**
* Return string containing the contents of the HTML file.
* This function performs any necessary filtering, like image URL replacement.
* @param $baseImageUrl string base URL for image references
* @return string
*/
function getHTMLContents()
{
import('file.ArticleFileManager');
$fileManager =& new ArticleFileManager($this->getArticleId());
$contents = $fileManager->readFile($this->getFileId());
$journal =& Request::getJournal();
// Replace media file references
$images =& $this->getImageFiles();
foreach ($images as $image) {
$imageUrl = Request::url(null, 'article', 'viewFile', array($this->getArticleId(), $this->getBestGalleyId($journal), $image->getFileId()));
$pattern = preg_quote(rawurlencode($image->getOriginalFileName()));
$contents = preg_replace('/([Ss][Rr][Cc]|[Hh][Rr][Ee][Ff]|[Dd][Aa][Tt][Aa])\\s*=\\s*"([^"]*' . $pattern . ')"/', '\\1="' . $imageUrl . '"', $contents);
// Replacement for Flowplayer
$contents = preg_replace('/[Uu][Rr][Ll]\\s*\\:\\s*\'(' . $pattern . ')\'/', 'url:\'' . $imageUrl . '\'', $contents);
// Replacement for other players (ested with odeo; yahoo and google player won't work w/ OJS URLs, might work for others)
$contents = preg_replace('/[Uu][Rr][Ll]=([^"]*' . $pattern . ')/', 'url=' . $imageUrl, $contents);
}
// Perform replacement for ojs://... URLs
$contents = String::regexp_replace_callback('/(<[^<>]*")[Oo][Jj][Ss]:\\/\\/([^"]+)("[^<>]*>)/', array(&$this, '_handleOjsUrl'), $contents);
// Perform variable replacement for journal, issue, site info
$issueDao =& DAORegistry::getDAO('IssueDAO');
$issue =& $issueDao->getIssueByArticleId($this->getArticleId());
$journal =& Request::getJournal();
$site =& Request::getSite();
$paramArray = array('issueTitle' => $issue ? $issue->getIssueIdentification() : Locale::translate('editor.article.scheduleForPublication.toBeAssigned'), 'journalTitle' => $journal->getJournalTitle(), 'siteTitle' => $site->getSiteTitle(), 'currentUrl' => Request::getRequestUrl());
foreach ($paramArray as $key => $value) {
$contents = str_replace('{$' . $key . '}', $value, $contents);
}
return $contents;
}
示例14: saveProgramSettings
/**
* Save changes to program settings.
*/
function saveProgramSettings()
{
$this->validate();
$this->setupTemplate(true);
$schedConf =& Request::getSchedConf();
if (!$schedConf) {
Request::redirect(null, null, 'index');
}
import('classes.manager.form.ProgramSettingsForm');
$settingsForm = new ProgramSettingsForm();
$settingsForm->readInputData();
$formLocale = $settingsForm->getFormLocale();
$programTitle = Request::getUserVar('programFileTitle');
$editData = false;
if (Request::getUserVar('uploadProgramFile')) {
if (!$settingsForm->uploadProgram('programFile', $formLocale)) {
$settingsForm->addError('programFile', Locale::translate('common.uploadFailed'));
}
$editData = true;
} elseif (Request::getUserVar('deleteProgramFile')) {
$settingsForm->deleteProgram('programFile', $formLocale);
$editData = true;
}
if (!$editData && $settingsForm->validate()) {
$settingsForm->execute();
$templateMgr =& TemplateManager::getManager();
$templateMgr->assign(array('currentUrl' => Request::url(null, null, null, 'program'), 'pageTitle' => 'schedConf.program', 'message' => 'common.changesSaved', 'backLink' => Request::url(null, null, Request::getRequestedPage()), 'backLinkLabel' => 'manager.conferenceSiteManagement'));
$templateMgr->display('common/message.tpl');
} else {
$settingsForm->display();
}
}
示例15: addItem
function addItem($args, &$request)
{
$this->setupTemplate();
$pressSettingsDao =& DAORegistry::getDAO('PressSettingsDAO');
$press =& $request->getPress();
$index = 'sourceTitle-' . $this->getId();
$format = $args[$index];
if (!isset($format)) {
$json = new JSON('false');
return $json->getString();
} else {
// Make sure the item doesn't already exist
$formats = $pressSettingsDao->getSetting($press->getId(), 'cataloguingMetadata');
foreach ($formats as $item) {
if ($item['name'] == $format) {
$json = new JSON('false', Locale::translate('common.listbuilder.itemExists'));
return $json->getString();
return false;
}
}
$formats[] = array('name' => $format);
$pressSettingsDao->updateSetting($press->getId(), 'cataloguingMetadata', $formats, 'object');
// Return JSON with formatted HTML to insert into list
$row =& $this->getRowInstance();
$row->setGridId($this->getId());
$row->setId($format);
$rowData = array('item' => $format);
$row->setData($rowData);
$row->initialize($request);
$json = new JSON('true', $this->_renderRowInternally($request, $row));
return $json->getString();
}
}