{renderButton(
- "Forgotten Password",
+ t("ForgottenPassword") as string,
form.state.errors,
"forgot-password",
handleForgetPassword,
@@ -209,7 +212,7 @@ const LoginForm: React.FC = () => {
{renderError("_general", form.state.errors)}
{renderInput(
"securityCode",
- "Authenticate",
+ t("Authenticate") as string,
form.state.data,
form.state.errors,
InputType.text,
@@ -221,7 +224,7 @@ const LoginForm: React.FC = () => {
undefined,
form.handleChange,
)}
- {renderButton("Authenticate", form.state.errors, "authenticate")}
+ {renderButton(t("Authenticate"), form.state.errors, "authenticate")}
My Authenticator is not working
diff --git a/src/modules/frame/components/Logout.tsx b/src/modules/frame/components/Logout.tsx
index 167e0c4..66c77bf 100644
--- a/src/modules/frame/components/Logout.tsx
+++ b/src/modules/frame/components/Logout.tsx
@@ -1,9 +1,10 @@
import React, { useEffect } from "react";
import { useTranslation } from "react-i18next";
+import { Namespaces } from "../../../i18n/i18n";
import authentication from "../services/authenticationService";
const Logout: React.FC = () => {
- const { t } = useTranslation();
+ const { t } = useTranslation
();
useEffect(() => {
authentication.logout();
diff --git a/src/modules/frame/components/NotFound.tsx b/src/modules/frame/components/NotFound.tsx
index 12ac48c..02df1ea 100644
--- a/src/modules/frame/components/NotFound.tsx
+++ b/src/modules/frame/components/NotFound.tsx
@@ -1,8 +1,9 @@
import React from "react";
import { useTranslation } from "react-i18next";
+import { Namespaces } from "../../../i18n/i18n";
const NotFound: React.FC = () => {
- const { t } = useTranslation();
+ const { t } = useTranslation();
return {t("NotFound")}
;
};
diff --git a/src/modules/homepage/HomePage.tsx b/src/modules/homepage/HomePage.tsx
index 2379cd8..3f72e0c 100644
--- a/src/modules/homepage/HomePage.tsx
+++ b/src/modules/homepage/HomePage.tsx
@@ -1,8 +1,9 @@
import React from "react";
import { useTranslation } from "react-i18next";
+import { Namespaces } from "../../i18n/i18n";
const HomePage: React.FC = () => {
- const { t } = useTranslation();
+ const { t } = useTranslation();
const redirect = () => {
window.location.href = "/organisations";
diff --git a/src/modules/manager/customfields/components/CustomFieldsTable.tsx b/src/modules/manager/customfields/components/CustomFieldsTable.tsx
index b0c9da0..a1e71fe 100644
--- a/src/modules/manager/customfields/components/CustomFieldsTable.tsx
+++ b/src/modules/manager/customfields/components/CustomFieldsTable.tsx
@@ -1,5 +1,6 @@
import React from "react";
import { useTranslation } from "react-i18next";
+import { Namespaces } from "../../../../i18n/i18n";
import Column from "../../../../components/common/columns";
import Table, {
PublishedTableProps,
@@ -10,7 +11,7 @@ import { CustomField } from "../services/customFieldsService";
const CustomFieldsTable: React.FC> = (
props,
) => {
- const { t } = useTranslation();
+ const { t } = useTranslation();
const columns: Column[] = [
{ key: "name", label: t("Name"), order: "asc" },
diff --git a/src/modules/manager/customfields/customFieldDetails.tsx b/src/modules/manager/customfields/customFieldDetails.tsx
index 487b677..166cac6 100644
--- a/src/modules/manager/customfields/customFieldDetails.tsx
+++ b/src/modules/manager/customfields/customFieldDetails.tsx
@@ -2,6 +2,8 @@ import Joi from "joi";
import React, { useEffect } from "react";
import { Navigate, useParams } from "react-router-dom";
import { toast } from "react-toastify";
+import { useTranslation } from "react-i18next";
+import { Namespaces } from "../../../i18n/i18n";
import { InputType } from "../../../components/common/Input";
import { useForm } from "../../../components/common/useForm";
import {
@@ -35,21 +37,22 @@ const CustomFieldDetails: React.FC = ({
editMode = false,
}) => {
const { customFieldId } = useParams<{ customFieldId: string }>();
+ const { t } = useTranslation();
- const labelName = "Name";
- const labelFieldType = "Field Type";
- const labelMultiLine = "Multi-line";
- const labelDefaultValue = "Default Value";
- const labelMinValue = "Minimum Value";
- const labelMaxValue = "Maximum Value";
- const labelStep = "Step";
- const labelRequired = "Required";
- const labelMinEntries = "Min Entries";
- const labelMaxEntries = "Max Entries (empty=unlimited)";
- let labelRefElementId = "Sequence/Form/Glossary";
+ const labelName = t("Name");
+ const labelFieldType = t("FieldType");
+ const labelMultiLine = t("MultiLine");
+ const labelDefaultValue = t("DefaultValue");
+ const labelMinValue = t("MinimumValue");
+ const labelMaxValue = t("MaximumValue");
+ const labelStep = t("Step");
+ const labelRequired = t("Required");
+ const labelMinEntries = t("MinEntries");
+ const labelMaxEntries = t("MaxEntriesEmptyUnlimited");
+ let labelRefElementId = t("SequenceFormGlossary");
- const labelApply = "Save";
- const labelSave = "Save and close";
+ const labelApply = t("Save");
+ const labelSave = t("SaveAndClose");
const form = useForm({
loaded: false,
@@ -111,22 +114,14 @@ const CustomFieldDetails: React.FC = ({
then: Joi.number(),
otherwise: Joi.number()
.min(Joi.ref("minValue"))
- .message(
- '"Default Value" must be greater than or equal to "' +
- labelMinValue +
- '"',
- ),
+ .message(t("DefaultMustBeGreaterThanOrEqualToMinimumValue")),
})
.when("maxValue", {
is: Joi.any().valid(null, ""),
then: Joi.number(),
otherwise: Joi.number()
.max(Joi.ref("maxValue"))
- .message(
- '"Default Value" must be less than or equal to "' +
- labelMaxValue +
- '"',
- ),
+ .message(t("DefaultMustBeLessThanOrEqualToMaximumValue")),
})
.allow(""),
otherwise: Joi.string().allow(""),
@@ -305,7 +300,7 @@ const CustomFieldDetails: React.FC = ({
params,
);
if (response) {
- toast.info("Custom Field edited");
+ toast.info(t("CustomFieldEdited"));
}
} else {
const response = await customFieldsService.postField(
@@ -318,7 +313,7 @@ const CustomFieldDetails: React.FC = ({
params,
);
if (response) {
- toast.info("New Custom Field added");
+ toast.info(t("NewCustomFieldAdded"));
}
}
@@ -337,33 +332,35 @@ const CustomFieldDetails: React.FC = ({
const { fieldType } = form.state.data;
const fieldTypeValue = typeof fieldType === "string" ? fieldType : "";
- let mode = "Add";
- if (isEditMode()) mode = "Edit";
+ let mode = t("Add");
+ if (isEditMode()) mode = t("Edit");
const fieldTypeOptions: Option[] = [
- { _id: "Text", name: "Text" },
- { _id: "Number", name: "Number" },
- { _id: "Sequence", name: "Sequence" },
- { _id: "FormTemplate", name: "Form Template" },
- { _id: "Glossary", name: "Glossary" },
- { _id: "Domain", name: "Domain" },
+ { _id: "Text", name: t("Text") },
+ { _id: "Number", name: t("Number") },
+ { _id: "Sequence", name: t("Sequence") },
+ { _id: "FormTemplate", name: t("FormTemplate") },
+ { _id: "Glossary", name: t("Glossary") },
+ { _id: "Domain", name: t("Domain") },
];
switch (fieldTypeValue) {
case "Sequence":
- labelRefElementId = "Sequence";
+ labelRefElementId = t("Sequence");
break;
case "FormTemplate":
- labelRefElementId = "Form";
+ labelRefElementId = t("Form");
break;
case "Glossary":
- labelRefElementId = "Glossary";
+ labelRefElementId = t("Glossary");
break;
}
return (
- {mode} Custom Field
+
+ {mode} {t("CustomField")}
+