diff --git a/Makefile b/Makefile index 8a4ffdb136b..c28c2c8475e 100755 --- a/Makefile +++ b/Makefile @@ -155,6 +155,8 @@ locales: 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/schedule_module/locale/ja/LC_MESSAGES/schedule_module.mo modules/schedule_module/locale/ja/LC_MESSAGES/schedule_module.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/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 npx i18next-conv -l ja -s modules/statistics/locale/ja/LC_MESSAGES/statistics.po -t modules/statistics/locale/ja/LC_MESSAGES/statistics.json @@ -209,9 +211,10 @@ 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 target=server_processes_manager npm run compile diff --git a/modules/publication/jsx/publicationIndex.js b/modules/publication/jsx/publicationIndex.js index 2c33c9cd2d8..a4103687902 100644 --- a/modules/publication/jsx/publicationIndex.js +++ b/modules/publication/jsx/publicationIndex.js @@ -6,14 +6,15 @@ import React from 'react'; import PropTypes from 'prop-types'; import {ButtonElement} from 'jsx/Form'; import StaticDataTable from 'jsx/StaticDataTable'; +import i18n from 'I18nSetup'; +import {withTranslation} from 'react-i18next'; +import hiStrings from '../locale/hi/LC_MESSAGES/publication.json'; +import FilterableDataTable from 'FilterableDataTable'; /** * Publication index component */ class PublicationIndex extends React.Component { - /** - * @constructor - */ constructor() { super(); loris.hiddenHeaders = [ @@ -25,127 +26,170 @@ class PublicationIndex extends React.Component { filter: {}, }; - // Bind component instance to custom methods this.fetchData = this.fetchData.bind(this); this.updateFilter = this.updateFilter.bind(this); this.resetFilters = this.resetFilters.bind(this); } - /** - * Called by React when the component has been rendered on the page. - */ componentDidMount() { this.fetchData(); } - /** - * Fetch data - */ fetchData() { - fetch(this.props.DataURL, { - method: 'GET', - }).then( - (response) => { + fetch(this.props.DataURL, {method: 'GET'}) + .then((response) => { if (!response.ok) { console.error(response.status); return; } - - response.json().then( - (data) => this.setState({ + response.json().then((data) => + this.setState({ Data: data, isLoaded: true, }) ); - }).catch((error) => console.error(error)); + }) + .catch((error) => console.error(error)); } - /** - * Update filter - * - * @param {*} filter - */ updateFilter(filter) { this.setState({filter}); } - /** - * Reset filters - */ resetFilters() { this.publicationsFilter.clearFilter(); } - /** - * Renders the React component. - * - * @return {JSX} - React markup for the component - */ render() { + const {t} = this.props; + if (!this.state.isLoaded) { return ( ); } - let tabList = [ - { - id: 'browse', - label: 'Browse', - }, - ]; + + let tabList = [{id: 'browse', label: t('Browse', {ns: 'publication'})}]; let proposalTab; + if (loris.userHasPermission('publication_propose')) { - tabList.push({ - id: 'propose', - label: 'Propose a Project', - }); + tabList.push({id: 'propose', label: t('Propose a Project', {ns: 'publication'})}); proposalTab = ( ); } - const filterRef = function(f) { - this.publicationsFilter = f; - }.bind(this); + const filterRef = (f) => (this.publicationsFilter = f); + + const fields = [ + { + label: t('Title', {ns: 'publication'}), + show: true, + filter: {name: 'Title', type: 'text'}, + }, + { + label: t('Lead Investigator', {ns: 'publication'}), + show: true, + filter: {name: 'leadInvestigator', type: 'text'}, + }, + { + label: t('Date Proposed', {ns: 'publication'}), + show: true, + filter: {hide: true}, + }, + { + label: t('Approval Status', {ns: 'publication'}), + show: true, + filter: { + name: 'approvalStatus', + type: 'select', + options: this.state.Data.form.approvalStatus.options, + }, + }, + { + label: t('Project', {ns: 'publication'}), + show: true, + filter: { + name: 'project', + type: 'select', + options: this.state.Data.form.project.options, + }, + }, + { + label: t('Journal', {ns: 'publication'}), + show: true, + filter: {name: 'journal', type: 'text'}, + }, + { + label: t('Link', {ns: 'publication'}), + show: true, + filter: {name: 'link', type: 'text'}, + }, + { + label: t('Publishing Status', {ns: 'publication'}), + show: true, + filter: { + name: 'publishingStatus', + type: 'select', + options: this.state.Data.form.publishingStatus.options, + }, + }, + { + label: t('Date Published', {ns: 'publication'}), + show: true, + filter: {name: 'datePublished', type: 'date', hide: true}, + }, + { + label: t('Project Proposal Creator', {ns: 'publication'}), + show: true, + filter: {name: 'projectProposalCreator', type: 'text'}, + }, + { + label: 'Description', + show: false, + filter: {name: 'description',hide: true}, + }, + { + label: t('Collaborators', {ns: 'publication'}), + show: true, + filter: {name: 'collaborators',hide: true}, + }, + { + label: t('Variables Of Interest', {ns: 'publication'}), + show: true, + filter: {name: 'variablesOfInterest', type: 'text'}, + }, + { + label: t('Keywords', {ns: 'publication'}), + show: true, + filter: {name: 'keywords', type: 'text'}, + }, + { + label: 'Publication ID', + show: false, + filter: {name: 'PublicationID', hide: true}, + }, + ]; return ( - -
- -
-
@@ -154,51 +198,36 @@ class PublicationIndex extends React.Component { ); } - /** - * Format column - * - * @param {string} column - * @param {*} cell - * @param {object} rowData - * @param {string[]} rowHeaders - * @return {JSX} - React markup for the component - */ formatColumn(column, cell, rowData, rowHeaders) { - // If a column if set as hidden, don't display it if (loris.hiddenHeaders.indexOf(column) > -1) { return null; } - // Create the mapping between rowHeaders and rowData in a row object. - let row = {}; - rowHeaders.forEach(function(header, index) { - row[header] = rowData[index]; - }, this); - let classes = []; - if (column === 'Title') { - let pubID = row['Publication ID']; - let viewURL = loris.BaseURL + '/publication/view_project?id=' + pubID; - +// if (column === 'शीर्षक') { +if (rowHeaders[0] === column){ + const pubID = rowData['Publication ID']; + const viewURL = `${loris.BaseURL}/publication/view_project?id=${pubID}`; return ( - - {cell} - + {cell} ); } - return {cell}; + return {cell}; } } PublicationIndex.propTypes = { DataURL: PropTypes.string, }; -document.addEventListener('DOMContentLoaded', () => { - createRoot( - document.getElementById('lorisworkspace') - ).render( +window.addEventListener('load', () => { + i18n.addResourceBundle('hi', 'publication', hiStrings); + + const PubIndex = withTranslation(['publication'])(PublicationIndex); + + createRoot(document.getElementById('lorisworkspace')).render(
- +
); }); + diff --git a/modules/publication/locale/hi/LC_MESSAGES/publication.po b/modules/publication/locale/hi/LC_MESSAGES/publication.po new file mode 100644 index 00000000000..4fca7f8f34c --- /dev/null +++ b/modules/publication/locale/hi/LC_MESSAGES/publication.po @@ -0,0 +1,181 @@ +# Default LORIS strings to be translated (English). +# Copy this to a language specific file and add translations to the +# new file. +# Copyright (C) 2025 +# This file is distributed under the same license as the LORIS package. +# Dave MacFarlane , 2025. +# +msgid "" +msgstr "" +"Project-Id-Version: LORIS 27\n" +"Report-Msgid-Bugs-To: https://github.com/aces/Loris/issues\n" +"POT-Creation-Date: 2025-04-08 14:37-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: hi\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +msgid "Publications" +msgstr "प्रकाशन" + +msgid "Loading" +msgstr "लोड हो रहा है" + +msgid "Browse" +msgstr "ब्राउज़ करें" + +msgid "File to upload" +msgstr "अपलोड करने के लिए फ़ाइल" + +msgid "Upload" +msgstr "अपलोड करें" + +msgid "Are you sure?" +msgstr "क्या आप सुनिश्चित हैं?" + +msgid "Cancel" +msgstr "रद्द करें" + +msgid "Submit" +msgstr "जमा करें" + +msgid "Title" +msgstr "शीर्षक" + +msgid "Year" +msgstr "वर्ष" + +msgid "Authors" +msgstr "लेखक" + +msgid "Journal" +msgstr "जर्नल" + +msgid "DOI" +msgstr "डीओआई" + +msgid "Action" +msgstr "क्रिया" + +msgid "Please fix any remaining form errors before submission" +msgstr "कृपया सबमिट करने से पहले शेष फॉर्म त्रुटियों को ठीक करें" + +msgid "Something went wrong!" +msgstr "कुछ गलत हो गया!" + +msgid "Submission Successful!" +msgstr "सबमिशन सफल रहा!" + +msgid "Propose a Project" +msgstr "एक प्रोजेक्ट प्रस्तावित करें" + +msgid "Propose a new project" +msgstr "एक नया प्रोजेक्ट प्रस्तावित करें" + +msgid "Edit failed!" +msgstr "संपादन विफल रहा!" + +msgid "Edit Successful!" +msgstr "संपादन सफल रहा!" + +msgid "Download" +msgstr "डाउनलोड करें" + +msgid "Citation" +msgstr "उद्धरण" + +msgid "Version" +msgstr "संस्करण" + +msgid "Collaborators" +msgstr "सहयोगी" + +msgid "Keywords" +msgstr "कुंजीशब्द" + +msgid "Variables Of Interest" +msgstr "रुचि के चर" + +msgid "Description" +msgstr "विवरण" + +msgid "Publishing Status" +msgstr "प्रकाशन स्थिति" + +msgid "Date Published" +msgstr "प्रकाशित तिथि" + +msgid "Link" +msgstr "लिंक" + +msgid "Lead Investigator" +msgstr "मुख्य अन्वेषक" + +msgid "Lead Investigator Email" +msgstr "मुख्य अन्वेषक ईमेल" + +msgid "Status" +msgstr "स्थिति" + +msgid "Reason for rejection" +msgstr "अस्वीकृति का कारण" + +msgid "Pending" +msgstr "लंबित" + +msgid "Approved" +msgstr "स्वीकृत" + +msgid "Rejected" +msgstr "अस्वीकृत" + +msgid "For help finding variables of interest, consult" +msgstr "रुचि वाले वेरिएबल खोजने में सहायता के लिए, परामर्श करें" + +msgid "Date Proposed" +msgstr "प्रस्तावित तिथि" + +msgid "Approval Status" +msgstr "स्वीकृति स्थिति" + +msgid "Project" +msgstr "परियोजना" + +msgid "Project Proposal Creator" +msgstr "परियोजना प्रस्ताव निर्माता" + +msgid "Published" +msgstr "प्रकाशित" + +msgid "In Progress" +msgstr "प्रगति पर" + +msgid "View Project" +msgstr "परियोजना देखें" + +msgid "LORIS Users with Edit Permission" +msgstr "संपादन अनुमति वाले LORIS उपयोगकर्ता" + +msgid "Type of Variables of Interest" +msgstr "रुचि वाले वेरिएबल का प्रकार" + +msgid "Propose Project" +msgstr "परियोजना प्रस्तावित करें" + +msgid "Send email notification?" +msgstr "ईमेल अधिसूचना भेजें?" + +msgid "Add User" +msgstr "उपयोगकर्ता जोड़ें" + +msgid "Add Collaborator" +msgstr "सहयोगी जोड़ें" + +msgid "Add Keyword" +msgstr "कीवर्ड जोड़ें" + +msgid "Add Variable of Interest" +msgstr "रुचि वाला वेरिएबल जोड़ें" diff --git a/modules/publication/locale/publication.pot b/modules/publication/locale/publication.pot index f7f3d9c8763..b04d26b7ecc 100644 --- a/modules/publication/locale/publication.pot +++ b/modules/publication/locale/publication.pot @@ -20,3 +20,162 @@ msgstr "" msgid "Publications" msgstr "" + +msgid "Loading" +msgstr "" + +msgid "Browse" +msgstr "" + +msgid "File to upload" +msgstr "" + +msgid "Upload" +msgstr "" + +msgid "Are you sure?" +msgstr "" + +msgid "Cancel" +msgstr "" + +msgid "Submit" +msgstr "" + +msgid "Title" +msgstr "" + +msgid "Year" +msgstr "" + +msgid "Authors" +msgstr "" + +msgid "Journal" +msgstr "" + +msgid "DOI" +msgstr "" + +msgid "Action" +msgstr "" + +msgid "Please fix any remaining form errors before submission" +msgstr "" + +msgid "Something went wrong!" +msgstr "" + +msgid "Submission Successful!" +msgstr "" + +msgid "Propose a Project" +msgstr "" + +msgid "Propose a new project" +msgstr "" + +msgid "Edit failed!" +msgstr "" + +msgid "Edit Successful!" +msgstr "" + +msgid "Download" +msgstr "" + +msgid "Citation" +msgstr "" + +msgid "Version" +msgstr "" + +msgid "Collaborators" +msgstr "" + +msgid "Keywords" +msgstr "" + +msgid "Variables Of Interest" +msgstr "" + +msgid "Description" +msgstr "" + +msgid "Publishing Status" +msgstr "" + +msgid "Date Published" +msgstr "" + +msgid "Link" +msgstr "" + +msgid "Lead Investigator" +msgstr "" + +msgid "Lead Investigator Email" +msgstr "" + +msgid "Status" +msgstr "" + +msgid "Reason for rejection" +msgstr "" + +msgid "Pending" +msgstr "" + +msgid "Approved" +msgstr "" + +msgid "Rejected" +msgstr "" + +msgid "For help finding variables of interest, consult" +msgstr "" + +msgid "Date Proposed" +msgstr "" + +msgid "Approval Status" +msgstr "" + +msgid "Project" +msgstr "" + +msgid "Project Proposal Creator" +msgstr "" + +msgid "Published" +msgstr "" + +msgid "In Progress" +msgstr "" + +msgid "View Project" +msgstr "" + +msgid "LORIS Users with Edit Permission" +msgstr "" + +msgid "Type of Variables of Interest" +msgstr "" + +msgid "Propose Project" +msgstr "" + +msgid "Send email notification?" +msgstr "" + +msgid "Add User" +msgstr "" + +msgid "Add Collaborator" +msgstr "" + +msgid "Add Keyword" +msgstr "" + +msgid "Add Variable of Interest" +msgstr "" diff --git a/modules/publication/php/publication.class.inc b/modules/publication/php/publication.class.inc index ba4d3aae1d0..da1e59303ec 100644 --- a/modules/publication/php/publication.class.inc +++ b/modules/publication/php/publication.class.inc @@ -126,21 +126,21 @@ class Publication extends \NDB_Menu_Filter_Form $this->query = $query; $this->headers = [ - 'Title', - 'Lead Investigator', - 'Date Proposed', - 'Approval Status', - 'Project', - 'Journal', - 'Link', - 'Publishing Status', - 'Date published', - 'Project Proposal Creator', - 'Description', - 'Collaborators', - 'Variables Of Interest', - 'Keywords', - 'Publication ID', + "Title", + "Lead Investigator", + "Date Proposed", + "Approval Status", + "Project", + "Journal", + "Link", + "Publishing Status", + "Date published", + "Project Proposal Creator", + "Description", + "Collaborators", + "Variables Of Interest", + "Keywords", + "Publication ID", ]; $this->validFilters = [ @@ -185,58 +185,61 @@ class Publication extends \NDB_Menu_Filter_Form $this->addBasicText( 'title', - 'Title' + "Title" ); $this->addSelect( 'approvalStatus', - 'Approval Status', + "Approval Status", $statusOptions ); // filters by name $this->addBasicText( 'leadInvestigator', - 'Lead Investigator' + "Lead Investigator" ); //also filters by name $this->addBasicText( 'collaborators', - 'Collaborators' + "Collaborators" ); $this->addBasicText( 'keywords', - 'Keywords' + "Keywords" ); $this->addBasicText( 'variablesOfInterest', - 'Variables of Interest' + "Variables of Interest" ); $this->addBasicText( 'journal', - 'Journal' + "Journal" ); $this->addSelect( 'project', - 'Project', + "Project", $projectOptions ); $this->addBasicText( 'link', - 'Link' + "Link" ); + $pubPublished = "Published"; + $pubInProgress = "In Progress"; + $this->addSelect( 'publishingStatus', - 'Publishing Status', + "Publishing Status", [ - 'Published' => 'Published', - 'In Progress' => 'In Progress' + $pubPublished => $pubPublished, + $pubInProgress => $pubInProgress, ] ); }