Skip to content

🔥 The free & Open Source DocuSign alternative

fix: detect from browser's language and set it in dropdown by default

RaktimaNXG10083ac8070c
diff --git a/apps/OpenSign/public/locales/en/translation.json b/apps/OpenSign/public/locales/en/translation.json
index 284b79c3d..12f91e257 100644
--- a/apps/OpenSign/public/locales/en/translation.json
+++ b/apps/OpenSign/public/locales/en/translation.json
@@ -367,8 +367,9 @@
"otp-sent-alert":"OTP sent on your email",
"fields-required":"Fields required",
"signature-widget-alert-1" :"Please ensure there's at least one signature widget added",
- "signature-widget-alert-2" : "Please ensure all field is accurately filled and meets all requirements.",
+ "signature-widget-alert-2" : "Please ensure all field is accurately filled and meets all requirements.",
"encrypted-pdf-alert" :"Currently encrypted pdf files are not supported.",
+ "encrypted-pdf-alert-1" :"PFX file password is invalid.",
"user-not-exist":"User does not exist",
"template-signature-field":"Please add at least one signature field for all roles.",
"template-role-alert":"Please add roles first",
@@ -477,6 +478,7 @@
"signature-saved-alert":"Signature saved successfully.",
"fill-field":"Please fill out this field",
"error-template" :"Error: Template not found!",
+ "error":"Error",
"invalid-document":"Error: invalid document!",
"document-not-found" :"Document not Found!",
"document-signed-alert-1" :"You have successfully signed the document. You can download or print a copy of the partially signed document. A copy of the digitally signed document will be sent to the owner over email once it is signed by all signers.",
diff --git a/apps/OpenSign/public/locales/fr/translation.json b/apps/OpenSign/public/locales/fr/translation.json
index 1be2da25b..7740f4be4 100644
--- a/apps/OpenSign/public/locales/fr/translation.json
+++ b/apps/OpenSign/public/locales/fr/translation.json
@@ -367,6 +367,7 @@
"signature-widget-alert-1" :"Veuillez vous assurer qu'au moins un widget de signature a été ajouté",
"signature-widget-alert-2" :"Veuillez vous assurer que tous les champs sont remplis avec précision et répondent à toutes les exigences.",
"encrypted-pdf-alert" :"Les fichiers PDF actuellement cryptés ne sont pas pris en charge.",
+ "encrypted-pdf-alert-1" :"Le mot de passe du fichier PFX n'est pas valide.",
"user-not-exist" :"L'utilisateur n'existe pas",
"template-signature-field":"Veuillez ajouter au moins un champ de signature pour tous les rôles.",
"template-role-alert":"Veuillez d'abord ajouter des rôles",
@@ -475,6 +476,7 @@
"signature-saved-alert" :"Signature enregistrée avec succès.",
"fill-field":"Veuillez remplir ce champ",
"error-template":"Erreur : modèle introuvable ! ",
+ "error":"Erreur",
"invalid-document" :"Erreur : document invalide !",
"document-not-found" :"Document introuvable !",
"document-signed-alert-1" :"Vous avez signé le document avec succès. Vous pouvez télécharger ou imprimer une copie du document partiellement signé. Une copie du document signé numériquement sera envoyée au propriétaire par e-mail une fois qu'il sera signé par tous les signataires.",
diff --git a/apps/OpenSign/src/components/pdf/SelectLanguage.js b/apps/OpenSign/src/components/pdf/SelectLanguage.js
index 64a0adc09..247a5160b 100644
--- a/apps/OpenSign/src/components/pdf/SelectLanguage.js
+++ b/apps/OpenSign/src/components/pdf/SelectLanguage.js
@@ -1,3 +1,4 @@
+import i18next from "i18next";
import React, { useState } from "react";
import { useTranslation } from "react-i18next";
@@ -7,7 +8,7 @@ function SelectLanguage() {
{ value: "en", text: "English" },
{ value: "fr", text: "Français" }
];
- const [lang, setLang] = useState("en");
+ const [lang, setLang] = useState(i18next.language || "en");
// This function put query that helps to
// change the language
const handleChangeLang = (e) => {
@@ -15,11 +16,11 @@ function SelectLanguage() {
i18n.changeLanguage(e.target.value);
};
return (
- <div className={`flex justify-center items-center mt-4`}>
+ <div className={`flex justify-center items-center mt-3 pb-2 md:pb-0 `}>
<select
value={lang}
onChange={handleChangeLang}
- className="op-select op-select-bordered w-[15%] bg-white pt-0"
+ className="op-select op-select-bordered md:w-[15%] w-[50%] bg-white op-select-sm "
>
<option disabled selected>
select
diff --git a/apps/OpenSign/src/pages/SignyourselfPdf.js b/apps/OpenSign/src/pages/SignyourselfPdf.js
index f4e89373a..566050160 100644
--- a/apps/OpenSign/src/pages/SignyourselfPdf.js
+++ b/apps/OpenSign/src/pages/SignyourselfPdf.js
@@ -710,7 +710,7 @@ function SignYourSelf() {
setIsUiLoading(false);
if (err && err.message.includes("is encrypted.")) {
setIsAlert({
- header: "Error",
+ header: t("error"),
isShow: true,
alertMessage: t("encrypted-pdf-alert")
});
@@ -721,13 +721,13 @@ function SignYourSelf() {
"PKCS#12 MAC could not be verified. Invalid password?"
) {
setIsAlert({
- header: "Error",
+ header: t("error"),
isShow: true,
- alertMessage: `PFX file password is invalid.`
+ alertMessage: t("encrypted-pdf-alert-1")
});
} else {
setIsAlert({
- header: "Error",
+ header: t("error"),
isShow: true,
alertMessage: t("something-went-wrong-mssg")
});
@@ -739,7 +739,7 @@ function SignYourSelf() {
console.log("err in embedselfsign ", err);
setIsUiLoading(false);
setIsAlert({
- header: "Error",
+ header: t("error"),
isShow: true,
alertMessage: t("something-went-wrong-mssg")
});