Skip to content

Commit

Permalink
Updates in Internationalisation (#1708)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay-aot authored Nov 13, 2023
1 parent ad54f3f commit 7a59690
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 21 deletions.
16 changes: 9 additions & 7 deletions forms-flow-web/src/components/Application/ApplicationFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Col, Row } from "react-bootstrap";
import DateRangePicker from "@wojtekmaj/react-daterange-picker";
import { useDispatch, useSelector } from "react-redux";
import { getAllApplications } from "../../apiManager/services/applicationServices";
import { useTranslation } from "react-i18next";

const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) => {
const dispatch = useDispatch();
Expand All @@ -13,6 +14,7 @@ const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) =>
const [lastModified,setLastModified] = useState(filterParams.modified || null);
const pageNo = useSelector((state) => state.applications?.activePage);
const limit = useSelector((state) => state.applications?.countPerPage);
const { t } = useTranslation();
const handleClick = (e) => {
if (createSearchNode?.current?.contains(e.target)) {
return;
Expand Down Expand Up @@ -85,7 +87,7 @@ const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) =>
<div className="m-4 px-2">
<Row className="mt-2">
<Col>
<label>Submission Id</label>
<label>{t("Submission Id")}</label>
<input
className="form-control"
placeholder=""
Expand All @@ -94,7 +96,7 @@ const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) =>
/>
</Col>
<Col>
<label>Form Title</label>
<label>{t("Form Title")}</label>
<input
className="form-control"
placeholder=""
Expand All @@ -108,7 +110,7 @@ const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) =>
<div className="m-4 px-2">
<Row className="mt-2">
<Col>
<label>Submission Status</label>
<label>{t("Submission Status")}</label>
<input
className="form-control"
placeholder=""
Expand All @@ -117,7 +119,7 @@ const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) =>
/>
</Col>
<Col className="mr-2" >
<label>Modified Date</label>
<label>{t("Modified Date")}</label>
<DateRangePicker
onChange={(selectedRange) => {
onSetDateRange(selectedRange);
Expand All @@ -142,21 +144,21 @@ const ApplicationFilter = ({ setDisplayFilter,filterParams,setFilterParams }) =>
className="text-danger small "
onClick={() => clearAllFilters()}
>
Clear All Filters
{t("Clear All Filters")}
</span>
</Col>
<Col className="text-right">
<button
className="btn btn-light mr-1 "
onClick={() => setDisplayFilter(false)}
>
Cancel
{t("Cancel")}
</button>
<button
className="btn btn-dark"
onClick={() => applyFilters()}
>
Show results
{t("Show results")}
</button>
</Col>
</Row>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ const ApplicationTable = () => {
<span className="ml-2">
{t("Showing")} {(limit * pageNo ) - (limit - 1)} {t("to")}{" "}
{limit * pageNo > totalForms ? totalForms : limit * pageNo} {t("of")}{" "}
{totalForms} {t("Results")}
{totalForms} {t("results")}
</span>
</div>
<div className="d-flex align-items-center">
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-web/src/components/Dashboard/Dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ const Dashboard = React.memo(() => {
{numberofSubmissionListTo > totalItems
? totalItems
: numberofSubmissionListTo}{" "}
{t("of")} {totalItems}
{t("of")} {totalItems} {t("results")}
</span>
</div>

Expand Down
14 changes: 8 additions & 6 deletions forms-flow-web/src/components/Draft/DraftFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Col, Row } from "react-bootstrap";
import DateRangePicker from "@wojtekmaj/react-daterange-picker";
import { useDispatch, useSelector } from "react-redux";
import { fetchDrafts } from "../../apiManager/services/draftService";
import { useTranslation } from "react-i18next";

const DraftFilter = ({ setDisplayFilter, filterParams, setFilterParams }) => {
const dispatch = useDispatch();
Expand All @@ -14,6 +15,7 @@ const DraftFilter = ({ setDisplayFilter, filterParams, setFilterParams }) => {
);
const pageNo = useSelector((state) => state.draft?.activePage);
const limit = useSelector((state) => state.draft?.countPerPage);
const { t } = useTranslation();
const handleClick = (e) => {
if (createSearchNode?.current?.contains(e.target)) {
return;
Expand Down Expand Up @@ -83,7 +85,7 @@ const DraftFilter = ({ setDisplayFilter, filterParams, setFilterParams }) => {
<div className="m-4 px-2">
<Row className="mt-2">
<Col>
<label>Draft Id</label>
<label>{t("Draft Id")}</label>
<input
className="form-control"
placeholder=""
Expand All @@ -92,7 +94,7 @@ const DraftFilter = ({ setDisplayFilter, filterParams, setFilterParams }) => {
/>
</Col>
<Col>
<label>Draft Name</label>
<label>{t("Draft Name")}</label>
<input
className="form-control"
placeholder=""
Expand All @@ -105,7 +107,7 @@ const DraftFilter = ({ setDisplayFilter, filterParams, setFilterParams }) => {
<hr className="m-0 w-100" />
<div className="ml-3 d-flex flex-column col-4">

<label>Modified Date</label>
<label>{t("Modified Date")}</label>
<DateRangePicker
onChange={(selectedRange) => {
onSetDateRange(selectedRange);
Expand All @@ -129,18 +131,18 @@ const DraftFilter = ({ setDisplayFilter, filterParams, setFilterParams }) => {
className="text-danger small "
onClick={() => clearAllFilters()}
>
Clear All Filters
{t("Clear All Filters")}
</span>
</Col>
<Col className="text-right">
<button
className="btn btn-light mr-1 "
onClick={() => setDisplayFilter(false)}
>
Cancel
{t("Cancel")}
</button>
<button className="btn btn-dark" onClick={() => applyFilters()}>
Show results
{t("Show results")}
</button>
</Col>
</Row>
Expand Down
4 changes: 2 additions & 2 deletions forms-flow-web/src/components/Draft/DraftTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ const DraftTable = () => {
</Dropdown.Menu>
</Dropdown>
<span className="ml-2">
{t("Showing")} {(limit * pageNo) - (limit - 1)} {t("to")}{" "}
{t("Showing")} {(limit * pageNo ) - (limit - 1)} {t("to")}{" "}
{limit * pageNo > totalForms ? totalForms : limit * pageNo} {t("of")}{" "}
{totalForms} {t("Results")}
{totalForms} {t("results")}
</span>
</div>

Expand Down
8 changes: 4 additions & 4 deletions forms-flow-web/src/components/Form/constants/FormTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,13 +298,13 @@ function FormTable() {
)}
<td>{HelperServices?.getLocaldate(e.created)}</td>
<td>{_.capitalize(e.formType)}</td>
<td>{e.anonymous ? "Anonymous" : "Private"}</td>
<td>{e.anonymous ? t("Anonymous") : t("Private")}</td>
<td>
{" "}
<button
className={`btn ${e.status === 'active' ? 'published-forms-label' : 'unpublished-forms-label'}`}
>
{e.status === 'active' ? "Published" : "Unpublished"}
{e.status === 'active' ? t("Published") : t("Unpublished")}
</button>
</td>

Expand All @@ -323,7 +323,7 @@ function FormTable() {
<Dropdown className="shadow position-absolute bg-white" style={{zIndex:99}}>
<Dropdown.Item onClick={() => deleteForms(e)}>
<i className="fa fa-trash mr-2 text-danger" />
Delete
{t("Delete")}
</Dropdown.Item>
{(userRoles.includes(STAFF_REVIEWER) || userRoles.includes(CLIENT))?(
<Dropdown.Item onClick={() => {console.log(e);submitNewForm(e?._id)}}>
Expand Down Expand Up @@ -374,7 +374,7 @@ function FormTable() {
<span className="ml-2">
{t("Showing")} {limit * pageNo - (limit - 1)} {t("to")}{" "}
{limit * pageNo > totalForms ? totalForms : limit * pageNo}{" "}
{t("of")} {totalForms} {t("Results")}
{t("of")} {totalForms} {t("results")}
</span>
</div>
<div className="d-flex align-items-center">
Expand Down

0 comments on commit 7a59690

Please sign in to comment.