diff --git a/Makefile b/Makefile index ae8037c67e6..d624eb0b1b8 100755 --- a/Makefile +++ b/Makefile @@ -148,6 +148,8 @@ locales: msgfmt -o modules/next_stage/locale/es/LC_MESSAGES/next_stage.mo modules/next_stage/locale/es/LC_MESSAGES/next_stage.po msgfmt -o modules/oidc/locale/ja/LC_MESSAGES/oidc.mo modules/oidc/locale/ja/LC_MESSAGES/oidc.po msgfmt -o modules/publication/locale/ja/LC_MESSAGES/publication.mo modules/publication/locale/ja/LC_MESSAGES/publication.po + msgfmt -o modules/publication/locale/hi/LC_MESSAGES/publication.mo modules/publication/locale/hi/LC_MESSAGES/publication.po + npx i18next-conv -l hi -s modules/publication/locale/hi/LC_MESSAGES/publication.po -t modules/publication/locale/hi/LC_MESSAGES/publication.json msgfmt -o modules/schedule_module/locale/ja/LC_MESSAGES/schedule_module.mo modules/schedule_module/locale/ja/LC_MESSAGES/schedule_module.po msgfmt -o modules/server_processes_manager/locale/ja/LC_MESSAGES/server_processes_manager.mo modules/server_processes_manager/locale/ja/LC_MESSAGES/server_processes_manager.po msgfmt -o modules/statistics/locale/ja/LC_MESSAGES/statistics.mo modules/statistics/locale/ja/LC_MESSAGES/statistics.po @@ -199,7 +201,9 @@ candidate_parameters: modules/candidate_parameters/locale/ja/LC_MESSAGES/candida dashboard: modules/dashboard/locale/ja/LC_MESSAGES/dashboard.mo target=dashboard npm run compile -publication: modules/publication/locale/ja/LC_MESSAGES/publication.mo +publication: + msgfmt -o modules/publication/locale/hi/LC_MESSAGES/publication.mo modules/publication/locale/hi/LC_MESSAGES/publication.po + npx i18next-conv -l hi -s modules/publication/locale/hi/LC_MESSAGES/publication.po -t modules/publication/locale/hi/LC_MESSAGES/publication.json target=publication npm run compile server_processes_manager: modules/server_processes_manager/locale/ja/LC_MESSAGES/server_processes_manager.mo diff --git a/modules/publication/jsx/projectFields.js b/modules/publication/jsx/projectFields.js index a76e85e8ebf..a0ced702c1b 100644 --- a/modules/publication/jsx/projectFields.js +++ b/modules/publication/jsx/projectFields.js @@ -11,6 +11,7 @@ import { SelectElement, DateElement, } from 'jsx/Form'; +import {withTranslation} from 'react-i18next'; /** * Email element component @@ -49,6 +50,7 @@ class EmailElement extends React.Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; let disabled = this.props.disabled ? 'disabled' : null; let required = this.props.required ? 'required' : null; let errorMessage = null; @@ -94,7 +96,7 @@ class EmailElement extends React.Component { onChange={this.props.toggleEmailNotify} value={this.props.addressee} /> - Send email notification? + {t('Send email notification?', {ns: 'publication'})} @@ -113,6 +115,7 @@ EmailElement.propTypes = { id: PropTypes.string, toggleEmailNotify: PropTypes.func, addressee: PropTypes.string, + t: PropTypes.func, }; EmailElement.defaultProps = { name: '', @@ -130,6 +133,9 @@ EmailElement.defaultProps = { }, }; +export const TranslatedEmailElement = withTranslation( + ['publication', 'loris'])(EmailElement); + /** * Project form fields component * This class combines the common form elements between @@ -191,6 +197,7 @@ class ProjectFormFields extends React.Component { * @return {React.ReactElement[]} - Array of React markup for the component */ createFileFields() { + const {t} = this.props; let fileFields = []; // Create download link & edit fields for existing files if (this.props.files) { @@ -228,13 +235,13 @@ class ProjectFormFields extends React.Component { /> @@ -251,7 +258,7 @@ class ProjectFormFields extends React.Component { name={fileName} id={'publicationUploadEl_' + i} onUserInput={this.props.setFileData} - label="File to upload" + label={t('File to upload', {ns: 'publication'})} value={this.props.formData[fileName]} /> @@ -264,7 +271,7 @@ class ProjectFormFields extends React.Component {
@@ -302,7 +309,7 @@ class ProjectFormFields extends React.Component { function(c, i) { let name = 'collabEmail_' + c.name; collabEmails.push( - - For help finding variables of interest, consult - the Data Dictionary + {t('For help finding variables of interest, consult', + {ns: 'publication'})} +   + {t('Data Dictionary', + {ns: 'loris'})} ); let collabNames = []; @@ -433,14 +444,14 @@ class ProjectFormFields extends React.Component {
- {collabEmails} {fileFields}
); @@ -600,5 +611,7 @@ ProjectFormFields.propTypes = { allKWs: PropTypes.object, editMode: PropTypes.string, projectOptions: PropTypes.object, + t: PropTypes.func, }; -export default ProjectFormFields; +export default withTranslation( + ['publication', 'loris'])(ProjectFormFields); diff --git a/modules/publication/jsx/publicationIndex.js b/modules/publication/jsx/publicationIndex.js index 2c33c9cd2d8..534d076274b 100644 --- a/modules/publication/jsx/publicationIndex.js +++ b/modules/publication/jsx/publicationIndex.js @@ -6,16 +6,21 @@ import React from 'react'; import PropTypes from 'prop-types'; import {ButtonElement} from 'jsx/Form'; import StaticDataTable from 'jsx/StaticDataTable'; +import {withTranslation} from 'react-i18next'; + +import i18n from 'I18nSetup'; +import hiStrings from '../locale/hi/LC_MESSAGES/publication.json'; /** * Publication index component */ class PublicationIndex extends React.Component { /** + * @param {object} props - React Component properties * @constructor */ - constructor() { - super(); + constructor(props) { + super(props); loris.hiddenHeaders = [ 'Description', 'Publication ID', @@ -82,10 +87,11 @@ class PublicationIndex extends React.Component { * @return {JSX} - React markup for the component */ render() { + const {t} = this.props; if (!this.state.isLoaded) { return (