Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,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
Expand Down Expand Up @@ -184,7 +186,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
Expand Down
77 changes: 45 additions & 32 deletions modules/publication/jsx/projectFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
SelectElement,
DateElement,
} from 'jsx/Form';
import {withTranslation} from 'react-i18next';

/**
* Email element component
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -94,7 +96,7 @@ class EmailElement extends React.Component {
onChange={this.props.toggleEmailNotify}
value={this.props.addressee}
/>
<span>Send email notification?</span>
<span>{t('Send email notification?', {ns: 'publication'})}</span>
</span>
</div>
</div>
Expand All @@ -113,6 +115,7 @@ EmailElement.propTypes = {
id: PropTypes.string,
toggleEmailNotify: PropTypes.func,
addressee: PropTypes.string,
t: PropTypes.func,
};
EmailElement.defaultProps = {
name: '',
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -228,13 +235,13 @@ class ProjectFormFields extends React.Component {
/>
<TextboxElement
name={pubCit}
label="Citation"
label={t('Citation', {ns: 'publication'})}
onUserInput={this.props.setFormData}
value={this.props.formData[pubCit]}
/>
<TextboxElement
name={pubVer}
label="Publication Version"
label={t('Publication Version', {ns: 'publication'})}
onUserInput={this.props.setFormData}
value={this.props.formData[pubVer]}
/>
Expand All @@ -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]}
/>
</div>
Expand All @@ -264,21 +271,21 @@ class ProjectFormFields extends React.Component {
<div>
<SelectElement
name={publicationType}
label="Publication Type"
label={t('Publication Type', {ns: 'publication'})}
onUserInput={this.props.setFormData}
value={this.props.formData[publicationType]}
options={this.props.uploadTypes}
required={true}
/>
<TextboxElement
name={publicationCitation}
label="Citation"
label={t('Citation', {ns: 'publication'})}
onUserInput={this.props.setFormData}
value={this.props.formData[publicationCitation]}
/>
<TextboxElement
name={publicationVersion}
label="Publication Version"
label={t('Publication Version', {ns: 'publication'})}
onUserInput={this.props.setFormData}
value={this.props.formData[publicationVersion]}
/>
Expand All @@ -302,7 +309,7 @@ class ProjectFormFields extends React.Component {
function(c, i) {
let name = 'collabEmail_' + c.name;
collabEmails.push(
<EmailElement
<TranslatedEmailElement
name={name}
label={c.name + (c.name.slice(-1) === 's' ?
'\'' :
Expand Down Expand Up @@ -391,13 +398,17 @@ class ProjectFormFields extends React.Component {
* @return {JSX} - React markup for the component
*/
render() {
const {t} = this.props;
let collabEmails = this.createCollabEmailFields();
let fileFields = this.createFileFields();

let voiHelp = (
<span>
For help finding variables of interest, consult
the <a href={loris.BaseURL + '/datadict/'}>Data Dictionary</a>
{t('For help finding variables of interest, consult',
{ns: 'publication'})}
&nbsp;
<a href={loris.BaseURL + '/datadict/'}>{t('Data Dictionary',
{ns: 'loris'})}</a>
</span>
);
let collabNames = [];
Expand Down Expand Up @@ -433,14 +444,14 @@ class ProjectFormFields extends React.Component {
<div>
<TextareaElement
name="description"
label="Description"
label={t('Description', {ns: 'publication'})}
onUserInput={this.props.setFormData}
required={true}
value={this.props.formData.description}
/>
<SelectElement
name="project"
label="Project"
label={t('Project', {ns: 'loris'})}
options={this.props.projectOptions}
onUserInput={this.props.setFormData}
required={true}
Expand All @@ -449,7 +460,7 @@ class ProjectFormFields extends React.Component {
/>
<SelectElement
name="publishingStatus"
label="Publishing status"
label={t('Publishing status', {ns: 'publication'})}
options={publishingStatusOptions}
onUserInput={this.props.setFormData}
required={true}
Expand All @@ -458,46 +469,46 @@ class ProjectFormFields extends React.Component {
/>
<DateElement
name="datePublication"
label="Date published"
label={t('Date published', {ns: 'publication'})}
onUserInput={this.props.setFormData}
required={published}
value={this.props.formData.datePublication}
disabled={!published}
/>
<TextboxElement
name="journal"
label="Journal"
label={t('Journal', {ns: 'publication'})}
onUserInput={this.props.setFormData}
required={published}
value={this.props.formData.journal}
disabled={!published}
/>
<TextboxElement
name="doi"
label="DOI"
label={t('DOI', {ns: 'publication'})}
onUserInput={this.props.setFormData}
required={false}
value={this.props.formData.doi}
disabled={!published}
/>
<TextboxElement
name="link"
label="Link"
label={t('Link', {ns: 'publication'})}
onUserInput={this.props.setFormData}
required={published}
value={this.props.formData.link}
disabled={!published}
/>
<TextboxElement
name="leadInvestigator"
label="Lead Investigator"
label={t('Lead Investigator', {ns: 'publication'})}
onUserInput={this.props.setFormData}
required={true}
value={this.props.formData.leadInvestigator}
/>
<EmailElement
<TranslatedEmailElement
name="leadInvestigatorEmail"
label="Lead Investigator Email"
label={t('Lead Investigator Email', {ns: 'publication'})}
onUserInput={this.props.setFormData}
toggleEmailNotify={this.toggleEmailNotify}
errorMessage={this.props.formErrors.leadInvestigatorEmail}
Expand All @@ -508,7 +519,7 @@ class ProjectFormFields extends React.Component {
<TagsElement
name="usersWithEditPerm"
id="usersWithEditPerm"
label="LORIS Users with Edit Permission"
label={t('LORIS Users with Edit Permission', {ns: 'publication'})}
options={this.props.users}
useSearch={true}
strictSearch={true}
Expand All @@ -518,12 +529,12 @@ class ProjectFormFields extends React.Component {
value={this.props.formData.pendingUWEP}
pendingValKey="pendingUWEP"
items={this.props.formData.usersWithEditPerm}
btnLabel="Add User"
btnLabel={t('Add User', {ns: 'publication'})}
/>
<TagsElement
name="collaborators"
id="collaborators"
label="Collaborators"
label={t('Collaborators', {ns: 'publication'})}
options={this.props.allCollabs}
useSearch={true}
strictSearch={false}
Expand All @@ -533,13 +544,13 @@ class ProjectFormFields extends React.Component {
value={this.props.formData.pendingCollab}
pendingValKey="pendingCollab"
items={collabNames}
btnLabel="Add Collaborator"
btnLabel={t('Add Collaborator', {ns: 'publication'})}
/>
{collabEmails}
<TagsElement
name="keywords"
id="keywords"
label="Keywords"
label={t('Keywords', {ns: 'publication'})}
options={this.props.allKWs}
useSearch={true}
strictSearch={false}
Expand All @@ -549,11 +560,11 @@ class ProjectFormFields extends React.Component {
value={this.props.formData.pendingKWItem}
pendingValKey="pendingKWItem"
items={this.props.formData.keywords}
btnLabel="Add Keyword"
btnLabel={t('Add Keyword', {ns: 'publication'})}
/>
<SelectElement
name="voiType"
label="Type of Variables of Interest"
label={t('Type of Variables of Interest', {ns: 'publication'})}
options={voiTypeOptions}
onUserInput={this.props.setFormData}
value={this.props.formData.voiType}
Expand All @@ -562,7 +573,7 @@ class ProjectFormFields extends React.Component {
<TagsElement
name="voiFields"
id="voiFields"
label="Variables of Interest"
label={t('Variables of Interest', {ns: 'publication'})}
useSearch={true}
strictSearch={true}
onUserInput={this.props.setFormData}
Expand All @@ -573,15 +584,15 @@ class ProjectFormFields extends React.Component {
options={voiOptions}
pendingValKey="pendingItemVF"
items={this.props.formData.voiFields}
btnLabel="Add Variable of Interest"
btnLabel={t('Add Variable of Interest', {ns: 'publication'})}
/>
<StaticElement
text={voiHelp}
/>
{fileFields}
<ButtonElement label={this.props.editMode ?
'Submit' :
'Propose Project'}
t('Submit', {ns: 'publication'}) :
t('Propose Project', {ns: 'publication'})}
/>
</div>
);
Expand All @@ -604,5 +615,7 @@ ProjectFormFields.propTypes = {
allKWs: PropTypes.object,
editMode: PropTypes.string,
projectOptions: PropTypes.object,
t: PropTypes.func,
};
export default ProjectFormFields;
export default withTranslation(
['publication', 'loris'])(ProjectFormFields);
Loading
Loading