Locale Class Reference

Provides methods for loading locale data and translating strings identified by unique keys. More...

List of all members.

Public Member Functions

_getAllLocalesCache ()
 checkLengths ($reference, $value)
 extractFields (&$node)
getAllLocales ()
 getEmailTemplateFilename ($locale)
 getLocale ()
getLocaleFiles ($locale=null)
 getLocalePrecedence ()
 getMainLocaleFilename ($locale)
 getParameterNames ($source)
 getPrimaryLocale ()
 getSupportedLocales ()
 initialize ()
 installLocale ($locale)
 isLocaleValid ($locale)
loadLocaleList ($filename)
registerLocaleFile ($locale, $filename, $addToTop=false)
 reloadLocale ($locale)
 testEmails ($locale, $referenceLocale)
 testLocale ($locale, $referenceLocale)
 translate ($key, $params=array(), $locale=null)
 uninstallLocale ($locale)


Detailed Description

Provides methods for loading locale data and translating strings identified by unique keys.

Definition at line 43 of file Locale.inc.php.


Member Function Documentation

& Locale._getAllLocalesCache (  ) 

Get the cache object for the current list of all locales.

Definition at line 284 of file Locale.inc.php.

Referenced by getAllLocales().

Locale.checkLengths ( reference,
value 
)

Determine whether or not the lengths of the two supplied values are "similar".

Parameters:
$reference string
$value string
Returns:
boolean True if the lengths match very roughly.

Definition at line 549 of file Locale.inc.php.

References String.strlen().

Referenced by LocaleFile.testLocale().

Locale.extractFields ( &$  node  ) 

Given a parent XML node, extract child nodes of the following form: <field name="something">some_value</field> ... into an associate array $array['something'] = 'some_value';

Parameters:
$node object
Returns:
array

Definition at line 534 of file Locale.inc.php.

Referenced by testEmails().

& Locale.getAllLocales (  ) 

Locale.getEmailTemplateFilename ( locale  ) 

Get the path and filename for the email templates data for the given locale

Parameters:
$locale string
Returns:
string

Definition at line 365 of file Locale.inc.php.

Referenced by TranslatorAction.export(), and testEmails().

Locale.getLocale (  ) 

Return the key name of the user's currently selected locale (default is "en_US" for U.S. English).

Returns:
string

Definition at line 164 of file Locale.inc.php.

References Request.getCookieVar(), Request.getJournal(), SessionManager.getManager(), Request.getSite(), getSupportedLocales(), Request.getUserVar(), Config.getVar(), and isLocaleValid().

Referenced by OAIDAO._returnRecordFromRow(), AboutHandler.aboutThisPublishingSystem(), Plugin.addHelpData(), Plugin.addLocaleData(), IssueHandler.archive(), TinyMCEPlugin.callback(), IssueHandler.current(), Form.display(), PayPalPlugin.displayPaymentForm(), DOAJPlugin.emailRep(), EmailHandler.emails(), EmailTemplateForm.execute(), EditorAction.expediteSubmission(), AnnouncementTypeDAO.getAnnouncementTypeName(), ArticleDAO.getArticle(), ArticleReportDAO.getArticleReport(), ArticleDAO.getArticlesByJournalId(), ArticleDAO.getArticlesByUserId(), AuthorSubmissionDAO.getAuthorSubmission(), AuthorSubmissionDAO.getAuthorSubmissions(), CopyeditorSubmissionDAO.getCopyeditorSubmission(), CopyeditorSubmissionDAO.getCopyeditorSubmissionsByCopyeditorId(), EditorSubmissionDAO.getEditorSubmission(), EditorSubmissionDAO.getEditorSubmissions(), CountryDAO.getFilename(), Form.getFormLocale(), ArticleGalley.getGalleyLabel(), Journal.getJournalDescription(), Journal.getJournalPageHeaderLogo(), Journal.getJournalPageHeaderTitle(), Help.getLocale(), getLocalePrecedence(), PublishedArticle.getLocalizedGalleys(), PublishedArticleDAO.getPublishedArticleByArticleId(), PublishedArticleDAO.getPublishedArticleByPublicArticleId(), PublishedArticleDAO.getPublishedArticleIdsAlphabetizedByJournal(), PublishedArticleDAO.getPublishedArticles(), PublishedArticleDAO.getPublishedArticlesByJournalId(), PublishedArticleDAO.getPublishedArticlesBySectionId(), PublishedArticleDAO.getPublishedArticlesInSections(), ReviewerSubmissionDAO.getReviewerSubmission(), ReviewerSubmissionDAO.getReviewerSubmissionsByReviewerId(), SectionEditorSubmissionDAO.getSectionEditorSubmission(), SectionEditorSubmissionDAO.getSectionEditorSubmissions(), Site.getSitePageHeaderTitle(), ProofreaderSubmissionDAO.getSubmission(), LayoutEditorSubmissionDAO.getSubmission(), ProofreaderSubmissionDAO.getSubmissions(), LayoutEditorSubmissionDAO.getSubmissions(), SubscriptionTypeDAO.getSubscriptionTypeName(), EditorSubmissionDAO.getUnfilteredEditorSubmissions(), SectionEditorSubmissionDAO.getUnfilteredSectionEditorSubmissions(), ImportOJS1.importArticles(), ImportOJS1.importIssues(), ImportOJS1.importJournal(), ImportOJS1.importSections(), ImportOJS1.importSubscriptions(), ImportOJS1.importUsers(), AboutHandler.index(), EmailTemplateForm.initData(), InstallForm.initData(), initialize(), JournalSettingsDAO.installSettings(), MailTemplate.MailTemplate(), Installer.preInstall(), CustomLocalePlugin.register(), IssueHandler.setupIssueTemplate(), TemplateManager.TemplateManager(), translate(), LDAPAuthPlugin.userFromAttr(), HelpHandler.view(), and ArticleHandler.viewArticle().

& Locale.getLocaleFiles ( locale = null  ) 

Get a list of locale files currently registered, either in all locales (in an array for each locale), or for a specific locale.

Parameters:
$locale string Locale identifier (optional)

Definition at line 49 of file Locale.inc.php.

Referenced by genTestLocale.execute(), CustomLocalePlugin.register(), registerLocaleFile(), and translate().

Locale.getLocalePrecedence (  ) 

Get the stack of "important" locales, most important first.

Returns:
array

Definition at line 244 of file Locale.inc.php.

References Request.getJournal(), getLocale(), getPrimaryLocale(), and Request.getSite().

Locale.getMainLocaleFilename ( locale  ) 

Get the filename for the locale file given a locale name.

Definition at line 93 of file Locale.inc.php.

Referenced by initialize(), isLocaleValid(), and testLocale().

Locale.getParameterNames ( source  ) 

Given a locale string, get the list of parameter references of the form {$myParameterName}.

Parameters:
$source string
Returns:
array

Definition at line 564 of file Locale.inc.php.

References String.regexp_match_all().

Referenced by testEmails(), and LocaleFile.testLocale().

Locale.getPrimaryLocale (  ) 

Retrieve the primary locale of the current context.

Returns:
string

Definition at line 262 of file Locale.inc.php.

References Request.getJournal(), Request.getSite(), and isLocaleValid().

Referenced by AboutHandler.aboutThisPublishingSystem(), AnnouncementTypeDAO.getAnnouncementTypeName(), ArticleDAO.getArticle(), ArticleReportDAO.getArticleReport(), ArticleDAO.getArticlesByJournalId(), ArticleDAO.getArticlesByUserId(), AuthorSubmissionDAO.getAuthorSubmission(), AuthorSubmissionDAO.getAuthorSubmissions(), CopyeditorSubmissionDAO.getCopyeditorSubmission(), CopyeditorSubmissionDAO.getCopyeditorSubmissionsByCopyeditorId(), EditorSubmissionDAO.getEditorSubmission(), EditorSubmissionDAO.getEditorSubmissions(), Journal.getJournalPageHeaderLogo(), Journal.getJournalPageHeaderTitle(), getLocalePrecedence(), PublishedArticle.getLocalizedGalleys(), FormValidatorLocale.getMessage(), PublishedArticleDAO.getPublishedArticleByArticleId(), PublishedArticleDAO.getPublishedArticleByPublicArticleId(), PublishedArticleDAO.getPublishedArticleIdsAlphabetizedByJournal(), PublishedArticleDAO.getPublishedArticles(), PublishedArticleDAO.getPublishedArticlesByJournalId(), PublishedArticleDAO.getPublishedArticlesBySectionId(), PublishedArticleDAO.getPublishedArticlesInSections(), ReviewerSubmissionDAO.getReviewerSubmission(), ReviewerSubmissionDAO.getReviewerSubmissionsByReviewerId(), SectionEditorSubmissionDAO.getSectionEditorSubmission(), SectionEditorSubmissionDAO.getSectionEditorSubmissions(), Site.getSitePageHeaderTitle(), ProofreaderSubmissionDAO.getSubmission(), LayoutEditorSubmissionDAO.getSubmission(), ProofreaderSubmissionDAO.getSubmissions(), LayoutEditorSubmissionDAO.getSubmissions(), SubscriptionTypeDAO.getSubscriptionTypeName(), EditorSubmissionDAO.getUnfilteredEditorSubmissions(), SectionEditorSubmissionDAO.getUnfilteredSectionEditorSubmissions(), AboutHandler.index(), FormValidatorLocale.isValid(), UserXMLParser.parseData(), and ArticleEventLogEntry.setLogMessage().

Locale.getSupportedLocales (  ) 

Get all supported locales for the current context.

Returns:
array

Definition at line 144 of file Locale.inc.php.

References getAllLocales(), Request.getJournal(), Request.getSite(), and Config.getVar().

Referenced by Form.display(), and getLocale().

Locale.initialize (  ) 

Initialize the locale system.

Definition at line 100 of file Locale.inc.php.

References getLocale(), getMainLocaleFilename(), and registerLocaleFile().

Referenced by genTestLocale.execute().

Locale.installLocale ( locale  ) 

Uninstall support for an existing locale.

Parameters:
$locale string

Definition at line 379 of file Locale.inc.php.

Referenced by AdminLanguagesHandler.installLocale(), and reloadLocale().

Locale.isLocaleValid ( locale  ) 

& Locale.loadLocaleList ( filename  ) 

Load a locale list from a file.

Parameters:
$filename string
Returns:
array

Definition at line 308 of file Locale.inc.php.

Referenced by LanguageAction.getDownloadableLocales().

& Locale.registerLocaleFile ( locale,
filename,
addToTop = false 
)

Register a locale file against the current list.

Parameters:
$locale string Locale key
$filename string Filename to new locale XML file
$addToTop boolean Whether to add to the top of the list (true) or the bottom (false). Allows overriding.

Definition at line 123 of file Locale.inc.php.

References getLocaleFiles().

Referenced by Plugin.addLocaleData(), initialize(), and CustomLocalePlugin.register().

Locale.reloadLocale ( locale  ) 

Reload locale-specific data.

Parameters:
$locale string

Definition at line 410 of file Locale.inc.php.

References installLocale(), and uninstallLocale().

Referenced by AdminLanguagesHandler.reloadLocale().

Locale.testEmails ( locale,
referenceLocale 
)

Test the emails in the supplied locale against those in the supplied reference locale.

Parameters:
$locale string
$referenceLocale string
Returns:
array List of errors

Definition at line 453 of file Locale.inc.php.

References extractFields(), getEmailTemplateFilename(), and getParameterNames().

Referenced by localeCheck.execute().

Locale.testLocale ( locale,
referenceLocale 
)

Test all locale files for the supplied locale against the supplied reference locale, returning an array of errors.

Parameters:
$locale string Name of locale to test
$referenceLocale string Name of locale to test against
Returns:
array

Definition at line 422 of file Locale.inc.php.

References getMainLocaleFilename(), and PluginRegistry.loadAllPlugins().

Referenced by localeCheck.execute().

Locale.translate ( key,
params = array(),
locale = null 
)

Translate a string using the selected locale. Substitution works by replacing tokens like "{$foo}" with the value of the parameter named "foo" (if supplied).

Parameters:
$key string $params array named substitution parameters $locale string the locale to use
Returns:
string

Definition at line 71 of file Locale.inc.php.

References Registry.get(), getLocale(), and getLocaleFiles().

Referenced by ArticleSearch._parseQuery(), OAIDAO._returnRecordFromRow(), GroupHandler.addMembership(), EditorHandler.assignEditor(), SubmissionEditHandler.assignLayoutEditor(), SearchHandler.authors(), Install.createData(), IssueHandler.current(), UpgradeForm.dbInstallError(), InstallForm.dbInstallError(), ArticleReportPlugin.display(), NativeImportExportPlugin.display(), InstallForm.display(), AuthorSubmitStep1Form.display(), AdminLanguagesHandler.downloadLocale(), LanguageAction.downloadLocale(), SectionEditorAction.emailEditorDecisionComment(), SubmissionEditHandler.enrollSearch(), PeopleHandler.enrollSearch(), migrate.execute(), RegistrationForm.execute(), ArticleGalleyForm.execute(), JournalSiteSettingsForm.execute(), Installer.executeAction(), UserImportExportPlugin.executeCLI(), PubMedExportPlugin.executeCLI(), NativeImportExportPlugin.executeCLI(), EruditExportPlugin.executeCLI(), CrossRefExportPlugin.executeCLI(), EditorAction.expediteSubmission(), OJSCompletedPayment.getAssocDescription(), TurabianCitationPlugin.getCitationFormatName(), RefWorksCitationPlugin.getCitationFormatName(), RefManCitationPlugin.getCitationFormatName(), ProCiteCitationPlugin.getCitationFormatName(), MlaCitationPlugin.getCitationFormatName(), EndNoteCitationPlugin.getCitationFormatName(), CbeCitationPlugin.getCitationFormatName(), BibtexCitationPlugin.getCitationFormatName(), ApaCitationPlugin.getCitationFormatName(), AbntCitationPlugin.getCitationFormatName(), OpenAdsConnection.getConnection(), CustomThemePlugin.getDescription(), ArticleReportPlugin.getDescription(), PayPalPlugin.getDescription(), ManualPaymentPlugin.getDescription(), UserImportExportPlugin.getDescription(), SampleImportExportPlugin.getDescription(), PubMedExportPlugin.getDescription(), NativeImportExportPlugin.getDescription(), EruditExportPlugin.getDescription(), DOAJPlugin.getDescription(), CrossRefExportPlugin.getDescription(), XMLGalleyPlugin.getDescription(), WebFeedPlugin.getDescription(), WebFeedGatewayPlugin.getDescription(), WebFeedBlockPlugin.getDescription(), TranslatorPlugin.getDescription(), TinyMCEPlugin.getDescription(), ThesisFeedPlugin.getDescription(), ThesisFeedGatewayPlugin.getDescription(), ThesisFeedBlockPlugin.getDescription(), ThesisPlugin.getDescription(), SehlPlugin.getDescription(), RoundedCornersPlugin.getDescription(), PhpMyVisitesPlugin.getDescription(), OpenAdsPlugin.getDescription(), OpenAdsBlockPlugin.getDescription(), GoogleAnalyticsPlugin.getDescription(), CustomLocalePlugin.getDescription(), CounterPlugin.getDescription(), CoinsPlugin.getDescription(), CmsRssPlugin.getDescription(), CmsPlugin.getDescription(), CmsBlockPlugin.getDescription(), AnnouncementFeedPlugin.getDescription(), AnnouncementFeedGatewayPlugin.getDescription(), AnnouncementFeedBlockPlugin.getDescription(), ResolverPlugin.getDescription(), METSGatewayPlugin.getDescription(), TurabianCitationPlugin.getDescription(), RefWorksCitationPlugin.getDescription(), RefManCitationPlugin.getDescription(), ProCiteCitationPlugin.getDescription(), MlaCitationPlugin.getDescription(), EndNoteCitationPlugin.getDescription(), CbeCitationPlugin.getDescription(), BibtexCitationPlugin.getDescription(), ApaCitationPlugin.getDescription(), AbntCitationPlugin.getDescription(), UserBlockPlugin.getDescription(), SubscriptionBlockPlugin.getDescription(), RoleBlockPlugin.getDescription(), NavigationBlockPlugin.getDescription(), LanguageToggleBlockPlugin.getDescription(), InformationBlockPlugin.getDescription(), HelpBlockPlugin.getDescription(), FontSizeBlockPlugin.getDescription(), DonationBlockPlugin.getDescription(), DevelopedByBlockPlugin.getDescription(), LDAPAuthPlugin.getDescription(), OJSQueuedPayment.getDescription(), OJSCompletedPayment.getDescription(), CustomThemePlugin.getDisplayName(), ArticleReportPlugin.getDisplayName(), PayPalPlugin.getDisplayName(), ManualPaymentPlugin.getDisplayName(), UserImportExportPlugin.getDisplayName(), SampleImportExportPlugin.getDisplayName(), PubMedExportPlugin.getDisplayName(), NativeImportExportPlugin.getDisplayName(), EruditExportPlugin.getDisplayName(), DOAJPlugin.getDisplayName(), CrossRefExportPlugin.getDisplayName(), XMLGalleyPlugin.getDisplayName(), WebFeedPlugin.getDisplayName(), WebFeedGatewayPlugin.getDisplayName(), WebFeedBlockPlugin.getDisplayName(), TranslatorPlugin.getDisplayName(), TinyMCEPlugin.getDisplayName(), ThesisFeedPlugin.getDisplayName(), ThesisFeedGatewayPlugin.getDisplayName(), ThesisFeedBlockPlugin.getDisplayName(), ThesisPlugin.getDisplayName(), SehlPlugin.getDisplayName(), RoundedCornersPlugin.getDisplayName(), PhpMyVisitesPlugin.getDisplayName(), OpenAdsPlugin.getDisplayName(), OpenAdsBlockPlugin.getDisplayName(), GoogleAnalyticsPlugin.getDisplayName(), CustomLocalePlugin.getDisplayName(), CounterPlugin.getDisplayName(), CoinsPlugin.getDisplayName(), CmsRssPlugin.getDisplayName(), CmsPlugin.getDisplayName(), CmsBlockPlugin.getDisplayName(), AnnouncementFeedPlugin.getDisplayName(), AnnouncementFeedGatewayPlugin.getDisplayName(), AnnouncementFeedBlockPlugin.getDisplayName(), ResolverPlugin.getDisplayName(), METSGatewayPlugin.getDisplayName(), TurabianCitationPlugin.getDisplayName(), RefWorksCitationPlugin.getDisplayName(), RefManCitationPlugin.getDisplayName(), ProCiteCitationPlugin.getDisplayName(), MlaCitationPlugin.getDisplayName(), EndNoteCitationPlugin.getDisplayName(), CbeCitationPlugin.getDisplayName(), BibtexCitationPlugin.getDisplayName(), ApaCitationPlugin.getDisplayName(), AbntCitationPlugin.getDisplayName(), UserBlockPlugin.getDisplayName(), SubscriptionBlockPlugin.getDisplayName(), RoleBlockPlugin.getDisplayName(), NavigationBlockPlugin.getDisplayName(), LanguageToggleBlockPlugin.getDisplayName(), InformationBlockPlugin.getDisplayName(), HelpBlockPlugin.getDisplayName(), FontSizeBlockPlugin.getDisplayName(), DonationBlockPlugin.getDisplayName(), DevelopedByBlockPlugin.getDisplayName(), LDAPAuthPlugin.getDisplayName(), Installer.getErrorString(), ArticleHTMLGalley.getHTMLContents(), Issue.getIssueIdentification(), IssueAction.getIssueOptions(), CustomThemePlugin.getManagementVerbs(), XMLGalleyPlugin.getManagementVerbs(), WebFeedPlugin.getManagementVerbs(), TranslatorPlugin.getManagementVerbs(), TinyMCEPlugin.getManagementVerbs(), ThesisFeedPlugin.getManagementVerbs(), ThesisPlugin.getManagementVerbs(), SehlPlugin.getManagementVerbs(), RoundedCornersPlugin.getManagementVerbs(), PhpMyVisitesPlugin.getManagementVerbs(), OpenAdsPlugin.getManagementVerbs(), GoogleAnalyticsPlugin.getManagementVerbs(), CustomLocalePlugin.getManagementVerbs(), CounterPlugin.getManagementVerbs(), CoinsPlugin.getManagementVerbs(), CmsRssPlugin.getManagementVerbs(), CmsPlugin.getManagementVerbs(), AnnouncementFeedPlugin.getManagementVerbs(), ResolverPlugin.getManagementVerbs(), METSGatewayPlugin.getManagementVerbs(), ReportPlugin.getManagementVerbs(), ImportExportPlugin.getManagementVerbs(), GatewayPlugin.getManagementVerbs(), AuthPlugin.getManagementVerbs(), FormValidator.getMessage(), OJSQueuedPayment.getName(), OJSCompletedPayment.getName(), Thesis.getStudentFullName(), Thesis.getSupervisorFullName(), ImportOJS1.importJournal(), UserXMLParser.importUsers(), InformationHandler.index(), Plugin.installData(), InstallForm.InstallForm(), XMLGalleyPlugin.manage(), PeopleHandler.mergeUsers(), AdminPeopleHandler.mergeUsers(), JournalReportIterator.next(), SectionEditorAction.notifyReviewer(), UserXMLParser.parseData(), PeopleHandler.people(), installTool.printTitle(), installTool.readParam(), installTool.readParamBoolean(), installTool.readParamOptions(), installTool.readParams(), SectionEditorAction.recordDecision(), ReviewerAction.recordRecommendation(), OpenAdsPlugin.rtOutputFilter(), ProfileHandler.saveProfile(), AdminSettingsHandler.saveSettings(), SetupHandler.saveSetup(), HelpHandler.search(), SubscriptionManagerHandler.selectSubscriber(), SubscriptionHandler.selectSubscriber(), ArticleEventLogEntry.setLogMessage(), IssueHandler.setupIssueTemplate(), Form.smartyFieldLabel(), TemplateManager.smartyHtmlOptionsTranslate(), TemplateManager.smartyIcon(), TemplateManager.smartyPageInfo(), TemplateManager.smartyTranslate(), StudentThesisForm.StudentThesisForm(), SubmitHandler.submitUploadSuppFile(), SubscriptionTypeForm.SubscriptionTypeForm(), AdminFunctionsHandler.systemInfo(), ThesisForm.ThesisForm(), ThesisSettingsForm.ThesisSettingsForm(), Plugin.updateSchema(), ArticleGalleyForm.uploadImage(), SubmissionLayoutHandler.uploadLayoutFile(), SubmissionEditHandler.uploadSuppFile(), UserImportExportPlugin.usage(), PubMedExportPlugin.usage(), NativeImportExportPlugin.usage(), EruditExportPlugin.usage(), CrossRefExportPlugin.usage(), SuppFileForm.validate(), ArticleGalleyForm.validate(), and IssueForm.validate().

Locale.uninstallLocale ( locale  ) 

Install support for a new locale.

Parameters:
$locale string

Definition at line 399 of file Locale.inc.php.

References DAORegistry.getDAO().

Referenced by reloadLocale(), and AdminLanguagesHandler.uninstallLocale().


The documentation for this class was generated from the following file:

Generated on Mon Jul 14 10:55:44 2008 for Open Journal Systems by  doxygen 1.5.6