diff --git a/docs/api/activities.html b/docs/api/activities.html index ae4ced2a..91d8eed6 100644 --- a/docs/api/activities.html +++ b/docs/api/activities.html @@ -370,7 +370,7 @@
Invalid token. Please log in again.
403 Forbidden – You do not have permissions
403 Forbidden – You do not have permissions.
404 Not Found – activity not found
Sorry. That user already exists.
Username: 3 to 12 characters required.
3 to 12 characters required for usernanme.
Valid email must be provided.
Password and password confirmation don’t match.
Password: 8 characters required.
8 characters required for password.
User does not exist
User does not exist.
200 OK – success
User does not exist
User does not exist.
No picture.
{message}
+          {t(`messages:${message}`)}
         ) : (
           {message}}
+        {message && {t(`messages:${message}`)}}
         {message}
+          {t(`messages:${message}`)}
         ) : (
           {message}
+          {t(`messages:${message}`)}
         ) : (
           activities &&
           sports.length > 0 && (
diff --git a/fittrackee_client/src/components/User/Profile.jsx b/fittrackee_client/src/components/User/Profile.jsx
index 8e7eec0f..a77094dc 100644
--- a/fittrackee_client/src/components/User/Profile.jsx
+++ b/fittrackee_client/src/components/User/Profile.jsx
@@ -20,7 +20,7 @@ function Profile({ message, onDeletePicture, onUploadPicture, t, user }) {
       {message}}
+      {message !== '' && {t(`messages:${message}`)}}
       {message}}
+        {message !== '' && {t(`messages:${message}`)}}
         {formData.isAuthenticated && (
           {message}}
+            {message !== '' && {t(`messages:${message}`)}}
             {messages.length > 0 && (
               
                 
                   {messages.map(msg => (
-                    - {msg.value}+
- {t(`messages:${msg.value}`)}))}
@@ -71,15 +78,17 @@ class UserForm extends React.Component {
     )
   }
 }
-export default connect(
-  state => ({
-    location: state.router.location,
-    message: state.message,
-    messages: state.messages,
-  }),
-  dispatch => ({
-    onHandleUserFormSubmit: (formData, formType) => {
-      dispatch(handleUserFormSubmit(formData, formType))
-    },
-  })
-)(UserForm)
+export default withTranslation()(
+  connect(
+    state => ({
+      location: state.router.location,
+      message: state.message,
+      messages: state.messages,
+    }),
+    dispatch => ({
+      onHandleUserFormSubmit: (formData, formType) => {
+        dispatch(handleUserFormSubmit(formData, formType))
+      },
+    })
+  )(UserForm)
+)
diff --git a/fittrackee_client/src/i18n.js b/fittrackee_client/src/i18n.js
index 74c89e24..b3720e86 100644
--- a/fittrackee_client/src/i18n.js
+++ b/fittrackee_client/src/i18n.js
@@ -5,12 +5,14 @@ import XHR from 'i18next-xhr-backend'
 import EnActivitiesTranslations from './locales/en/activities.json'
 import EnCommonTranslations from './locales/en/common.json'
 import EnDashboardTranslations from './locales/en/dashboard.json'
+import EnMessagesTranslations from './locales/en/messages.json'
 import EnSportsTranslations from './locales/en/sports.json'
 import EnStatisticsTranslations from './locales/en/statistics.json'
 import EnUserTranslations from './locales/en/user.json'
 import FrActivitiesTranslations from './locales/fr/activities.json'
 import FrCommonTranslations from './locales/fr/common.json'
 import FrDashboardTranslations from './locales/fr/dashboard.json'
+import FrMessagesTranslations from './locales/fr/messages.json'
 import FrSportsTranslations from './locales/fr/sports.json'
 import FrStatisticsTranslations from './locales/fr/statistics.json'
 import FrUserTranslations from './locales/fr/user.json'
@@ -31,6 +33,7 @@ i18n
         activities: EnActivitiesTranslations,
         common: EnCommonTranslations,
         dashboard: EnDashboardTranslations,
+        messages: EnMessagesTranslations,
         sports: EnSportsTranslations,
         statistics: EnStatisticsTranslations,
         user: EnUserTranslations,
@@ -39,6 +42,7 @@ i18n
         activities: FrActivitiesTranslations,
         common: FrCommonTranslations,
         dashboard: FrDashboardTranslations,
+        messages: FrMessagesTranslations,
         sports: FrSportsTranslations,
         statistics: FrStatisticsTranslations,
         user: FrUserTranslations,
diff --git a/fittrackee_client/src/locales/en/messages.json b/fittrackee_client/src/locales/en/messages.json
new file mode 100644
index 00000000..8105f783
--- /dev/null
+++ b/fittrackee_client/src/locales/en/messages.json
@@ -0,0 +1,26 @@
+{
+  "3 to 12 characters required for username.": "3 to 12 characters required for username.",
+  "8 characters required for password.": "8 characters required for password.",
+  "An error occurred. Please contact the administrator.": "An error occurred. Please contact the administrator.",
+  "Error during picture deletion.": "Error during picture deletion.",
+  "Error during picture update.":  "Error during picture update.",
+  "Error during picture update, file size exceeds max size.": "Error during picture update, file size exceeds max size.",
+  "Error. Registration is disabled.": "Error. Registration is disabled.",
+  "Error. Please try again or contact the administrator.": "Error. Please try again or contact the administrator.",
+  "File extension not allowed.": "File extension not allowed.",
+  "Invalid credentials.": "Invalid credentials.",
+  "Invalid payload.": "Invalid payload.",
+  "Invalid token. Please log in again.": "Invalid token. Please log in again.",
+  "No file part.": "No file part.",
+  "No picture.": "No picture.",
+  "No selected file.": "No selected file.",
+  "no gpx file for this activity": "no gpx file for this activity",
+  "Password and password confirmation don't match.": "Password and password confirmation don't match.",
+  "Provide a valid auth token": "Provide a valid auth token",
+  "Signature expired. Please log in again.": "Signature expired. Please log in again.",
+  "Sorry. That user already exists.": "Sorry. That user already exists.",
+  "Sport does not exist.": "Sport does not exist.",
+  "User does not exist.": "User does not exist.",
+  "Valid email must be provided.\n": "Valid email must be provided.",
+  "You do not have permissions.": "You do not have permissions."
+}
diff --git a/fittrackee_client/src/locales/fr/messages.json b/fittrackee_client/src/locales/fr/messages.json
new file mode 100644
index 00000000..f7549b1d
--- /dev/null
+++ b/fittrackee_client/src/locales/fr/messages.json
@@ -0,0 +1,26 @@
+{
+  "3 to 12 characters required for username.": "3 à 12 caractères requis pour le nom.",
+  "8 characters required for password.": "8 caractères minimum pour le mot de passe.",
+  "An error occurred. Please contact the administrator.": "Une erreur s'est produite. Merci de contacter l'administrateur.",
+  "Error during picture deletion.": "Erreur lors de la suppression de l'image.",
+  "Error during picture update.":  "Erreur lors de la mise à jour de l'image.",
+  "Error during picture update, file size exceeds max size.": "Erreur lors de la mise à jour de l'image, la taille du ficher dépasse la taille maximum autorisée",
+  "Error. Registration is disabled.": "Erreur. L'inscription est désactivée.",
+  "Error. Please try again or contact the administrator.": "Erreur. Veuillez réessayer ou contacter l'administrateur",
+  "File extension not allowed.": "Extension de fichier non autorisée",
+  "Invalid credentials.": "Identifiants invalides.",
+  "Invalid payload.": "Données incorrectes.",
+  "Invalid token. Please log in again.": "Jeton invalide. Merci de vous reconnecter.",
+  "No file part.": "Pas de fichier fourni.",
+  "No picture.": "Pas d'image.",
+  "No selected file.": "Pas de fichier sélectionné.",
+  "no gpx file for this activity": "pas de fichier gpx pour cette activité",
+  "Password and password confirmation don't match.": "Les mots de passe saisis sont différents.",
+  "Provide a valid auth token": "Merci de fournir un jeton valide",
+  "Signature expired. Please log in again.": "Signature expirée. Merci de vous reconnecter.",
+  "Sorry. That user already exists.": "Désolé. Cet utilisateur existe déjà.",
+  "Sport does not exist.": "Le sport n'existe pas.",
+  "User does not exist.": "L'utilisateur n'existe pas.",
+  "Valid email must be provided.\n": "L'email fourni n'est pas valide.",
+  "You do not have permissions.": "Vous n'avez pas les permissions nécessaires."
+}