From ffad398c0150b1866151743ca4dbaec28078757a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?L=C3=A9o=20Banno-Cloutier?=
 <leo.banno-cloutier@savoirfairelinux.com>
Date: Mon, 12 Jun 2023 15:46:50 -0400
Subject: [PATCH] jams-react-client: fix language configuration

Change-Id: I9b696bb7b58bf013b2e18710871857f606d1bdf0
---
 .../public/locales/en/translation.json        | 20 ++++++++++++++++++-
 .../public/locales/fr/translation.json        | 20 ++++++++++++++++++-
 .../LanguagePicker/LanguagePicker.js          | 13 +++++-------
 .../Blueprint/EditBlueprintPermissions.js     |  2 +-
 .../src/views/Blueprints/Blueprints.js        |  4 ++--
 5 files changed, 46 insertions(+), 13 deletions(-)

diff --git a/jams-react-client/public/locales/en/translation.json b/jams-react-client/public/locales/en/translation.json
index 522920ad..066e4a65 100644
--- a/jams-react-client/public/locales/en/translation.json
+++ b/jams-react-client/public/locales/en/translation.json
@@ -252,5 +252,23 @@
     "dht_configuration_popup": "Configure the DHT proxy server used by this account",
     "contact_management": "Contact management",
     "lookup_info": "If this option is disabled, user can not search and add new contacts",
-    "local_lan": "Local LAN"
+    "local_lan": "Local LAN",
+    "customization": "Customization",
+    "is_customization_enabled": "Enable customization",
+    "welcome_has_title": "Title",
+    "welcome_title": "Welcome to Jami",
+    "welcome_has_description": "Description",
+    "welcome_Description": "Here is your Jami identifier, don't hesitate to share it in order to be contacted more easily!",
+    "welcome_has_Tips": "Enable Tips display",
+    "instruction_title": "Use Jami title or personalize it (max 20 characters)",
+    "instruction_description": "Use Jami description or personalize it (max 100 characters)",
+    "welcome_has_BackgroundCustom": "Background",
+    "instruction_background": "Choose a background color or a background image",
+    "or": "or",
+    "welcome_has_Logo": "Logotype",
+    "instruction_logo": "Use Jami logotype or upload a logotype",
+    "call_parameters": "Call parameters",
+    "preview_tip1": "Add a picture and a nickname to complete your profile",
+    "preview_tip2": "Why should I save my account?",
+    "preview_tip3": "How to set shortcuts?"
 }
diff --git a/jams-react-client/public/locales/fr/translation.json b/jams-react-client/public/locales/fr/translation.json
index d388e975..0adb4847 100644
--- a/jams-react-client/public/locales/fr/translation.json
+++ b/jams-react-client/public/locales/fr/translation.json
@@ -252,5 +252,23 @@
     "dht_configuration_popup": "Configurer le serveur proxy DHT utilisé par ce compte",
     "contact_management": "Gestion des contacts",
     "lookup_info": "Si cette option est désactivée, les utilisateurs ne pourront pas rechercher ni ajouter de nouveaux contacts",
-    "local_lan": "Réseau local (LAN)"
+    "local_lan": "Réseau local (LAN)",
+    "customization": "Personaliser",
+    "is_customization_enabled": "Personaliser la page d'accueil",
+    "welcome_has_title": "Titre",
+    "welcome_title": "Bienvenue sur Jami",
+    "welcome_has_description": "Description",
+    "welcome_Description": "Voici votre identifiant Jami. N'hésitez pas à le partager afin d'être joint plus facilement.",
+    "welcome_has_Tips": "Afficher les conseils",
+    "instruction_title": "Utiliser le titre de Jami ou le personaliser (max 20 caractères)",
+    "instruction_description": "Utiliser la description de Jami ou le personaliser (max 100 caractères)",
+    "welcome_has_BackgroundCustom": "Arrière-plan",
+    "instruction_background": "Choisir une couleur ou une image d'arrière-plan",
+    "or": "ou",
+    "welcome_has_Logo": "Logo",
+    "instruction_logo": "Utiliser le logo de Jami ou téléverser un logo",
+    "call_parameters": "Paramètres d'appels",
+    "preview_tip1": "Add a picture and a nickname to complete your profile",
+    "preview_tip2": "Why should I save my account?",
+    "preview_tip3": "How to set shortcuts?"
 }
diff --git a/jams-react-client/src/components/LanguagePicker/LanguagePicker.js b/jams-react-client/src/components/LanguagePicker/LanguagePicker.js
index a86d5427..366d6a2e 100644
--- a/jams-react-client/src/components/LanguagePicker/LanguagePicker.js
+++ b/jams-react-client/src/components/LanguagePicker/LanguagePicker.js
@@ -30,14 +30,11 @@ export default function LanguagePicker(props) {
     fetch("/available_languages.json")
       .then((res) => res.json())
       .then((result) => {
-        const response = result.languages;
-        let translates_languages = [{ code: "en", name: "English" }];
-
-        response.forEach((lang) => {
-          if (result.stats[lang.code]["translated"]["percentage"] > 0.01) {
-            translates_languages.push(lang);
-          }
-        });
+        const response = result.data.map(({ attributes }) => attributes);
+        let translates_languages = [
+          ...response,
+          { code: "en", name: "English" },
+        ];
 
         let exists = false;
         translates_languages.map((option) => {
diff --git a/jams-react-client/src/views/Blueprint/EditBlueprintPermissions.js b/jams-react-client/src/views/Blueprint/EditBlueprintPermissions.js
index 96c4ba95..68f2cab8 100644
--- a/jams-react-client/src/views/Blueprint/EditBlueprintPermissions.js
+++ b/jams-react-client/src/views/Blueprint/EditBlueprintPermissions.js
@@ -392,7 +392,7 @@ export default function EditBlueprintPermissions(props) {
                     <Grid container spacing={2}>
                       <Grid item xs={12} sm={12} md={12}>
                         <FormLabel component="legend">
-                          Call parameters
+                          {i18next.t("call_parameters", "Call parameters")}
                         </FormLabel>
                         <FormGroup row>
                           <FormControlLabel
diff --git a/jams-react-client/src/views/Blueprints/Blueprints.js b/jams-react-client/src/views/Blueprints/Blueprints.js
index a3a81a95..b2b2834b 100644
--- a/jams-react-client/src/views/Blueprints/Blueprints.js
+++ b/jams-react-client/src/views/Blueprints/Blueprints.js
@@ -298,7 +298,7 @@ export default function Blueprints() {
             color="info"
             className={classes.whiteButtonText}
           >
-            Cancel
+            {i18next.t("cancel", "Cancel")}
           </Button>
           <Button
             onClick={handleCreateBlueprint}
@@ -306,7 +306,7 @@ export default function Blueprints() {
             disabled={disableCreate}
             autoFocus
           >
-            Create
+            {i18next.t("create_blueprint", "Create blueprint")}
           </Button>
         </DialogActions>
       </Dialog>
-- 
GitLab