From d6c3bd7fa45f8472cb8a58a92fc85e1ed2d17f46 Mon Sep 17 00:00:00 2001 From: Jonathan Bourdon Date: Fri, 18 Apr 2025 04:21:52 -0400 Subject: [PATCH] Add localization support for various components, including dialogs and views, in English, Spanish, and French. Implemented translations for user profile management, payment processes, and creator functionalities. Updated existing components to utilize the new translation system. --- .idea/.gitignore | 13 ++ .idea/encodings.xml | 4 + .idea/indexLayout.xml | 8 ++ .idea/vcs.xml | 6 + frontend/src/i18n.js | 19 +-- frontend/src/locales/en.json | 135 ------------------ frontend/src/locales/fr.json | 135 ------------------ frontend/src/stores/languageStore.js | 26 ++++ frontend/src/stores/userProfileStore.js | 7 + frontend/src/translations/common.en.json | 15 ++ frontend/src/translations/common.es.json | 15 ++ frontend/src/translations/common.fr.json | 15 ++ frontend/src/translations/translations.js | 95 ++++++++++++ frontend/src/views/LoginView.en.json | 4 + frontend/src/views/LoginView.es.json | 4 + frontend/src/views/LoginView.fr.json | 4 + frontend/src/views/LoginView.vue | 30 +--- frontend/src/views/PaymentCompleted.en.json | 7 + frontend/src/views/PaymentCompleted.es.json | 7 + frontend/src/views/PaymentCompleted.fr.json | 7 + frontend/src/views/PaymentCompleted.vue | 36 +++-- frontend/src/views/PaymentFailed.en.json | 5 + frontend/src/views/PaymentFailed.es.json | 5 + frontend/src/views/PaymentFailed.fr.json | 5 + frontend/src/views/PaymentFailed.vue | 50 ++----- frontend/src/views/StripePayment.en.json | 5 + frontend/src/views/StripePayment.es.json | 5 + frontend/src/views/StripePayment.fr.json | 5 + frontend/src/views/StripePayment.vue | 10 +- .../src/views/creators/ActualBanner.en.json | 3 + .../src/views/creators/ActualBanner.es.json | 3 + .../src/views/creators/ActualBanner.fr.json | 3 + frontend/src/views/creators/ActualBanner.vue | 4 +- .../src/views/creators/BannerActions.en.json | 12 ++ .../src/views/creators/BannerActions.es.json | 12 ++ .../src/views/creators/BannerActions.fr.json | 12 ++ frontend/src/views/creators/BannerActions.vue | 28 ++-- .../src/views/creators/BannerEditor.en.json | 7 + .../src/views/creators/BannerEditor.es.json | 7 + .../src/views/creators/BannerEditor.fr.json | 7 + frontend/src/views/creators/BannerEditor.vue | 22 +-- .../src/views/creators/CreateCreator.en.json | 3 + .../src/views/creators/CreateCreator.es.json | 3 + .../src/views/creators/CreateCreator.fr.json | 3 + frontend/src/views/creators/CreateCreator.vue | 12 +- .../src/views/creators/CreatorHome.en.json | 19 +++ .../src/views/creators/CreatorHome.es.json | 19 +++ .../src/views/creators/CreatorHome.fr.json | 19 +++ frontend/src/views/creators/CreatorHome.vue | 47 +++--- .../src/views/creators/CreatorLayout.en.json | 5 + .../src/views/creators/CreatorLayout.es.json | 5 + .../src/views/creators/CreatorLayout.fr.json | 5 + frontend/src/views/creators/CreatorLayout.vue | 4 +- .../src/views/creators/CreatorLogo.en.json | 4 + .../src/views/creators/CreatorLogo.es.json | 4 + .../src/views/creators/CreatorLogo.fr.json | 4 + frontend/src/views/creators/CreatorLogo.vue | 5 +- .../views/creators/CreatorLogoEditor.en.json | 7 + .../views/creators/CreatorLogoEditor.es.json | 7 + .../views/creators/CreatorLogoEditor.fr.json | 7 + .../src/views/creators/CreatorLogoEditor.vue | 22 +-- .../creators/DonationButtonBanner.en.json | 10 ++ .../creators/DonationButtonBanner.es.json | 10 ++ .../creators/DonationButtonBanner.fr.json | 10 ++ .../views/creators/DonationButtonBanner.vue | 18 +-- .../src/views/creators/NameEditor.en.json | 3 + .../src/views/creators/NameEditor.es.json | 3 + .../src/views/creators/NameEditor.fr.json | 4 + frontend/src/views/creators/NameEditor.vue | 4 +- frontend/src/views/creators/NameTitle.en.json | 3 + frontend/src/views/creators/NameTitle.es.json | 3 + frontend/src/views/creators/NameTitle.fr.json | 3 + frontend/src/views/creators/NameTitle.vue | 6 +- frontend/src/views/main/Footer.en.json | 10 ++ frontend/src/views/main/Footer.es.json | 10 ++ frontend/src/views/main/Footer.fr.json | 10 ++ frontend/src/views/main/Footer.vue | 19 +-- frontend/src/views/main/SideBar.en.json | 7 + frontend/src/views/main/SideBar.es.json | 7 + frontend/src/views/main/SideBar.fr.json | 7 + frontend/src/views/main/SideBar.vue | 39 ++--- .../src/views/profile/ProfilePage.en.json | 22 +++ .../src/views/profile/ProfilePage.es.json | 22 +++ .../src/views/profile/ProfilePage.fr.json | 22 +++ frontend/src/views/profile/ProfilePage.vue | 84 ++++++----- .../profile/account/AddressDialog.en.json | 4 + .../profile/account/AddressDialog.es.json | 4 + .../profile/account/AddressDialog.fr.json | 4 + .../views/profile/account/AddressDialog.vue | 32 +++-- .../views/profile/account/AliasDialog.en.json | 4 + .../views/profile/account/AliasDialog.es.json | 4 + .../views/profile/account/AliasDialog.fr.json | 4 + .../src/views/profile/account/AliasDialog.vue | 10 +- .../profile/account/BirthdayDialog.en.json | 4 + .../profile/account/BirthdayDialog.es.json | 4 + .../profile/account/BirthdayDialog.fr.json | 4 + .../views/profile/account/BirthdayDialog.vue | 32 +++-- .../views/profile/account/EmailDialog.en.json | 4 + .../views/profile/account/EmailDialog.es.json | 4 + .../views/profile/account/EmailDialog.fr.json | 4 + .../src/views/profile/account/EmailDialog.vue | 10 +- .../profile/account/FullnameDialog.en.json | 5 + .../profile/account/FullnameDialog.es.json | 5 + .../profile/account/FullnameDialog.fr.json | 5 + .../views/profile/account/FullnameDialog.vue | 19 ++- .../views/profile/account/PhoneDialog.en.json | 4 + .../views/profile/account/PhoneDialog.es.json | 4 + .../views/profile/account/PhoneDialog.fr.json | 4 + .../src/views/profile/account/PhoneDialog.vue | 33 ++--- .../profile/account/PortraitDialog.en.json | 5 + .../profile/account/PortraitDialog.es.json | 5 + .../profile/account/PortraitDialog.fr.json | 5 + .../views/profile/account/PortraitDialog.vue | 34 ++--- .../profile/account/SocialsDialog.en.json | 8 ++ .../profile/account/SocialsDialog.es.json | 8 ++ .../profile/account/SocialsDialog.fr.json | 8 ++ .../views/profile/account/SocialsDialog.vue | 72 ++++++++++ .../profile/creators/ChangeNameDialog.en.json | 4 + .../profile/creators/ChangeNameDialog.es.json | 4 + .../profile/creators/ChangeNameDialog.fr.json | 4 + .../profile/creators/ChangeNameDialog.vue | 11 +- .../profile/creators/ChangeSlugDialog.en.json | 4 + .../profile/creators/ChangeSlugDialog.es.json | 4 + .../profile/creators/ChangeSlugDialog.fr.json | 4 + .../profile/creators/ChangeSlugDialog.vue | 10 +- .../creators/ChangeStripeIdDialog.en.json | 4 + .../creators/ChangeStripeIdDialog.es.json | 4 + .../creators/ChangeStripeIdDialog.fr.json | 4 + .../profile/creators/ChangeStripeIdDialog.vue | 10 +- .../creators/ChangeTitleDialog.en.json | 4 + .../creators/ChangeTitleDialog.es.json | 4 + .../creators/ChangeTitleDialog.fr.json | 4 + .../profile/creators/ChangeTitleDialog.vue | 10 +- .../profile/creators/SocialsDialog.en.json | 11 ++ .../profile/creators/SocialsDialog.es.json | 11 ++ .../profile/creators/SocialsDialog.fr.json | 11 ++ .../views/profile/creators/SocialsDialog.vue | 24 ++-- 137 files changed, 1230 insertions(+), 614 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/encodings.xml create mode 100644 .idea/indexLayout.xml create mode 100644 .idea/vcs.xml delete mode 100644 frontend/src/locales/en.json delete mode 100644 frontend/src/locales/fr.json create mode 100644 frontend/src/stores/languageStore.js create mode 100644 frontend/src/translations/common.en.json create mode 100644 frontend/src/translations/common.es.json create mode 100644 frontend/src/translations/common.fr.json create mode 100644 frontend/src/translations/translations.js create mode 100644 frontend/src/views/LoginView.en.json create mode 100644 frontend/src/views/LoginView.es.json create mode 100644 frontend/src/views/LoginView.fr.json create mode 100644 frontend/src/views/PaymentCompleted.en.json create mode 100644 frontend/src/views/PaymentCompleted.es.json create mode 100644 frontend/src/views/PaymentCompleted.fr.json create mode 100644 frontend/src/views/PaymentFailed.en.json create mode 100644 frontend/src/views/PaymentFailed.es.json create mode 100644 frontend/src/views/PaymentFailed.fr.json create mode 100644 frontend/src/views/StripePayment.en.json create mode 100644 frontend/src/views/StripePayment.es.json create mode 100644 frontend/src/views/StripePayment.fr.json create mode 100644 frontend/src/views/creators/ActualBanner.en.json create mode 100644 frontend/src/views/creators/ActualBanner.es.json create mode 100644 frontend/src/views/creators/ActualBanner.fr.json create mode 100644 frontend/src/views/creators/BannerActions.en.json create mode 100644 frontend/src/views/creators/BannerActions.es.json create mode 100644 frontend/src/views/creators/BannerActions.fr.json create mode 100644 frontend/src/views/creators/BannerEditor.en.json create mode 100644 frontend/src/views/creators/BannerEditor.es.json create mode 100644 frontend/src/views/creators/BannerEditor.fr.json create mode 100644 frontend/src/views/creators/CreateCreator.en.json create mode 100644 frontend/src/views/creators/CreateCreator.es.json create mode 100644 frontend/src/views/creators/CreateCreator.fr.json create mode 100644 frontend/src/views/creators/CreatorHome.en.json create mode 100644 frontend/src/views/creators/CreatorHome.es.json create mode 100644 frontend/src/views/creators/CreatorHome.fr.json create mode 100644 frontend/src/views/creators/CreatorLayout.en.json create mode 100644 frontend/src/views/creators/CreatorLayout.es.json create mode 100644 frontend/src/views/creators/CreatorLayout.fr.json create mode 100644 frontend/src/views/creators/CreatorLogo.en.json create mode 100644 frontend/src/views/creators/CreatorLogo.es.json create mode 100644 frontend/src/views/creators/CreatorLogo.fr.json create mode 100644 frontend/src/views/creators/CreatorLogoEditor.en.json create mode 100644 frontend/src/views/creators/CreatorLogoEditor.es.json create mode 100644 frontend/src/views/creators/CreatorLogoEditor.fr.json create mode 100644 frontend/src/views/creators/DonationButtonBanner.en.json create mode 100644 frontend/src/views/creators/DonationButtonBanner.es.json create mode 100644 frontend/src/views/creators/DonationButtonBanner.fr.json create mode 100644 frontend/src/views/creators/NameEditor.en.json create mode 100644 frontend/src/views/creators/NameEditor.es.json create mode 100644 frontend/src/views/creators/NameEditor.fr.json create mode 100644 frontend/src/views/creators/NameTitle.en.json create mode 100644 frontend/src/views/creators/NameTitle.es.json create mode 100644 frontend/src/views/creators/NameTitle.fr.json create mode 100644 frontend/src/views/main/Footer.en.json create mode 100644 frontend/src/views/main/Footer.es.json create mode 100644 frontend/src/views/main/Footer.fr.json create mode 100644 frontend/src/views/main/SideBar.en.json create mode 100644 frontend/src/views/main/SideBar.es.json create mode 100644 frontend/src/views/main/SideBar.fr.json create mode 100644 frontend/src/views/profile/ProfilePage.en.json create mode 100644 frontend/src/views/profile/ProfilePage.es.json create mode 100644 frontend/src/views/profile/ProfilePage.fr.json create mode 100644 frontend/src/views/profile/account/AddressDialog.en.json create mode 100644 frontend/src/views/profile/account/AddressDialog.es.json create mode 100644 frontend/src/views/profile/account/AddressDialog.fr.json create mode 100644 frontend/src/views/profile/account/AliasDialog.en.json create mode 100644 frontend/src/views/profile/account/AliasDialog.es.json create mode 100644 frontend/src/views/profile/account/AliasDialog.fr.json create mode 100644 frontend/src/views/profile/account/BirthdayDialog.en.json create mode 100644 frontend/src/views/profile/account/BirthdayDialog.es.json create mode 100644 frontend/src/views/profile/account/BirthdayDialog.fr.json create mode 100644 frontend/src/views/profile/account/EmailDialog.en.json create mode 100644 frontend/src/views/profile/account/EmailDialog.es.json create mode 100644 frontend/src/views/profile/account/EmailDialog.fr.json create mode 100644 frontend/src/views/profile/account/FullnameDialog.en.json create mode 100644 frontend/src/views/profile/account/FullnameDialog.es.json create mode 100644 frontend/src/views/profile/account/FullnameDialog.fr.json create mode 100644 frontend/src/views/profile/account/PhoneDialog.en.json create mode 100644 frontend/src/views/profile/account/PhoneDialog.es.json create mode 100644 frontend/src/views/profile/account/PhoneDialog.fr.json create mode 100644 frontend/src/views/profile/account/PortraitDialog.en.json create mode 100644 frontend/src/views/profile/account/PortraitDialog.es.json create mode 100644 frontend/src/views/profile/account/PortraitDialog.fr.json create mode 100644 frontend/src/views/profile/account/SocialsDialog.en.json create mode 100644 frontend/src/views/profile/account/SocialsDialog.es.json create mode 100644 frontend/src/views/profile/account/SocialsDialog.fr.json create mode 100644 frontend/src/views/profile/account/SocialsDialog.vue create mode 100644 frontend/src/views/profile/creators/ChangeNameDialog.en.json create mode 100644 frontend/src/views/profile/creators/ChangeNameDialog.es.json create mode 100644 frontend/src/views/profile/creators/ChangeNameDialog.fr.json create mode 100644 frontend/src/views/profile/creators/ChangeSlugDialog.en.json create mode 100644 frontend/src/views/profile/creators/ChangeSlugDialog.es.json create mode 100644 frontend/src/views/profile/creators/ChangeSlugDialog.fr.json create mode 100644 frontend/src/views/profile/creators/ChangeStripeIdDialog.en.json create mode 100644 frontend/src/views/profile/creators/ChangeStripeIdDialog.es.json create mode 100644 frontend/src/views/profile/creators/ChangeStripeIdDialog.fr.json create mode 100644 frontend/src/views/profile/creators/ChangeTitleDialog.en.json create mode 100644 frontend/src/views/profile/creators/ChangeTitleDialog.es.json create mode 100644 frontend/src/views/profile/creators/ChangeTitleDialog.fr.json create mode 100644 frontend/src/views/profile/creators/SocialsDialog.en.json create mode 100644 frontend/src/views/profile/creators/SocialsDialog.es.json create mode 100644 frontend/src/views/profile/creators/SocialsDialog.fr.json diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..be698a9 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/projectSettingsUpdater.xml +/modules.xml +/contentModel.xml +/.idea.hutopy.iml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/indexLayout.xml b/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/frontend/src/i18n.js b/frontend/src/i18n.js index bb16827..aed51a2 100644 --- a/frontend/src/i18n.js +++ b/frontend/src/i18n.js @@ -1,15 +1,18 @@ import { createI18n } from 'vue-i18n'; -import en from './locales/en.json'; -import fr from './locales/fr.json'; +import { useSessionStorage } from '@vueuse/core'; + +// Get the stored locale or default to 'fr' +const storedLocale = useSessionStorage('user-locale', 'fr'); -const messages = { - en, - fr, -}; const i18n = createI18n({ legacy: false, - locale: 'fr', + locale: storedLocale.value, fallbackLocale: 'en', - messages, + messages: { + en: {}, + fr: {}, + es: {} + } }); + export default i18n; diff --git a/frontend/src/locales/en.json b/frontend/src/locales/en.json deleted file mode 100644 index 00e4d87..0000000 --- a/frontend/src/locales/en.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "general": { - "yes": "yes", - "no": "no" - }, - "banner": { - "subscription": "Subscriptions" - }, - "footer": { - "allRightsReserved": "All rights reserved", - "helpandcontact": "Help and contact", - "faq": "FAQ", - "creatorguide": "Creator guide", - "termsandconditions": "Terms and conditions", - "contentpolicy": "Content policy", - "about": "About", - "pricing": "Pricing" - }, - "subscribebutton": { - "subscribe": "Subscribe", - "unsubscribe": "Unsubscribe" - }, - "profilemenu": { - "manageyouraccount": "Manage your Hutopy account", - "creator": "Creator", - "user": "User" - }, - "header": { - "wallet": "Wallet" - }, - "message": { - "edit": "Edit", - "delete": "Delete", - "report": "Report", - "yourcomment": "Your comment..." - }, - "contentCard": { - "commenttitle": "comments", - "edit": "Edit", - "delete": "delete", - "report": "report", - "deletecontenttitle": "Delete this content?", - "deeletecontentwarning": "Are you sure you want to delete the content?" - }, - "time": { - "seconds": "seconds", - "1minuteago": "1 minute ago", - "1minutefromnow": "1 minute from now", - "minutes": "minutes", - "1hourago": "1 hour ago", - "1hourfromnow": "1 hour from now", - "hours": "hours", - "yesterday": "Yesterday", - "tomorrow": "Tomorrow", - "days": "days", - "lastweek": "Last week", - "nextweek": "Next week", - "weeks": "weeks", - "lastmonth": "Last month", - "nextmonth": "Next month", - "months": "months", - "lastyear": "Last year", - "nextyear": "Next year", - "years": "years", - "lastcentury": "Last century", - "nextcentury": "Next century", - "centuries": "centuries", - "ago": "ago" - }, - "personnalinformation": { - "informations": "Informations", - "title": "Personal information", - "profilepicture": "Profile picture", - "fullname": "Name", - "firstname": "Firstname", - "lastname": "Lastname", - "alias": "Alias", - "dob": "Date of birth", - "gender": "Gender", - "contactdetails": "Contact details", - "email": "Email", - "phone": "Phone", - "addresses": "Addresses", - "home": "Home", - "work": "Work" - }, - "creatorinfopage": { - "informations": "Informations", - "name": "Name", - "title": "Title", - "slug": "Slug", - "description": "Description", - "banner&profile": "Banner and profile picture", - "borderpicturecolor": "Profile picture border", - "menucolor": "Menu color", - "pageinformation": "Your page information", - "socialnetwork": "Social Network" - }, - "accountmanagement": { - "accounts": "Account", - "accountmanagement": "Account Management", - "pageid": "Page ID", - "addaccount": "Add Account", - "authoritygranted": "Granted Permissions" - }, - "security": { - "title": "Security", - "howtoconnect": "How to connect to Hutopy", - "password": "Password", - "recoverybyemail": "Recovery by Email", - "recoverybymobile": "Recovery by Mobile" - }, - "isupportbtn": { - "isupport": "I support", - "amount": "amount", - "message": "Message (optional)", - "send": "send" - }, - "paymentConfirmation": { - "success": { - "title": "Payment completed", - "message": "Your payment was successful. Thank you for supporting ", - "usernameDefault": "this user.", - "receipt": "A receipt has been sent to your email address.", - "continue": "Continue" - }, - "failure": { - "title": "Payment cancelled", - "message": "The payment was cancelled. If you did not intend to cancel, please try again.", - "thanks": "Thank you for supporting", - "tryAgain": "Try again", - "return": "Return to the profile of " - } - } -} diff --git a/frontend/src/locales/fr.json b/frontend/src/locales/fr.json deleted file mode 100644 index 77fa5fa..0000000 --- a/frontend/src/locales/fr.json +++ /dev/null @@ -1,135 +0,0 @@ -{ - "general": { - "yes": "oui", - "no": "non" - }, - "banner": { - "subscription": "Abonnés" - }, - "footer": { - "allRightsReserved": "Tout droits réservés", - "helpandcontact": "Aide & Contact", - "faq": "FAQ", - "creatorguide": "Guide pour les créateurs", - "termsandconditions": "Termes et conditions", - "contentpolicy": "Politique de contenu", - "about": "À propos", - "pricing": "Frais" - }, - "subscribebutton": { - "subscribe": "S'abonner", - "unsubscribe": "Se désabonner" - }, - "profilemenu": { - "manageyouraccount": "Gérer votre compte Hutopy", - "creator": "Créateur", - "user": "utilisateur" - }, - "header": { - "wallet": "PorteFeuille" - }, - "message": { - "edit": "Modifier", - "delete": "Effacer", - "report": "Signaler", - "yourcomment": "Votre commentaire..." - }, - "contentCard": { - "commenttitle": "commentaires", - "edit": "Modifier", - "delete": "Effacer", - "report": "signaler", - "deletecontenttitle": " Supprimer ce contenu?", - "deeletecontentwarning": "Êtes-vous sûr de vouloir supprimer le contenu?" - }, - "time": { - "seconds": "secondes", - "1minuteago": "Il y a 1 minute", - "1minutefromnow": "dans 1 minute", - "minutes": "minutes", - "1hourago": "Il y a 1 heure", - "1hourfromnow": "dans 1 heure", - "hours": "heures", - "yesterday": "hier", - "tomorrow": "demain", - "days": "jours", - "lastweek": "La semaine dernière.", - "nextweek": "La semaine prochaine", - "weeks": "semaines", - "lastmonth": "Le mois dernier", - "nextmonth": "Le mois prochain", - "months": "mois", - "lastyear": "L'année dernière", - "nextyear": "L'année prochaine", - "years": "années", - "lastcentury": "Le siècle dernier", - "nextcentury": "Le siècle prochain", - "centuries": "siècles", - "ago": "" - }, - "personnalinformation": { - "informations": "Informations", - "title": "Informations personnelles", - "profilepicture": "Photo de profil", - "fullname": "Nom", - "firstname": "Prénom", - "lastname": "Nom", - "alias": "Pseudonyme", - "dob": "Date de naissance", - "gender": "Genre", - "contactdetails": "Coordonnées", - "email": "Email", - "phone": "Téléphone", - "addresses": "Adresses", - "home": "Domicile", - "work": "Travail" - }, - "creatorinfopage": { - "informations": "Informations", - "name": "Nom", - "title": "Titre", - "slug": "Slug", - "description": "Description", - "banner&profile": "Bannière et photo de profil", - "borderpicturecolor": "Bordure de la photo de profil", - "menucolor": "Couleur des menus", - "pageinformation": "Informations de votre page", - "socialnetwork": "Réseaux sociaux" - }, - "accountmanagement": { - "accounts": "comptes", - "accountmanagement": "Gestion des comptes", - "pageid": "ID de la page", - "addaccount": "Ajouter un compte", - "authoritygranted": "Autorisations accordées" - }, - "security": { - "title": "Sécurité", - "howtoconnect": "Comment vous connecter à Hutopy", - "password": "Mot de passe", - "recoverybyemail": "Récupération par email", - "recoverybymobile": "Récupération par mobile" - }, - "isupportbtn": { - "isupport": "Je soutiens", - "amount": "Montant", - "message": "Message (facultatif)", - "send": "Envoyez" - }, - "paymentConfirmation": { - "success": { - "title": "Paiement complété", - "message": "Votre paiement a été effectué avec succès. Merci de soutenir ", - "usernameDefault": "cet utilisateur.", - "receipt": "Un reçu a été envoyé à votre adresse courriel.", - "continue": "Continuer" - }, - "failure": { - "title": "Paiement annulé", - "message": "Le paiement a été annulé. Si vous n'aviez pas l'intention d'annuler, veuillez réessayer.", - "thanks": "Merci de supporter", - "tryAgain": "Réessayer", - "return": "Retour au profil de " - } - } -} diff --git a/frontend/src/stores/languageStore.js b/frontend/src/stores/languageStore.js new file mode 100644 index 0000000..e79f1a4 --- /dev/null +++ b/frontend/src/stores/languageStore.js @@ -0,0 +1,26 @@ +import { defineStore } from 'pinia' +import { useSessionStorage } from '@vueuse/core' +import { useI18n } from 'vue-i18n' + +export const useLanguageStore = defineStore( + 'language', + () => { + const { locale } = useI18n() + + // Initialize with the stored value or default to 'fr' + const storedLocale = useSessionStorage('user-locale', 'fr') + + // Set the initial locale from storage + locale.value = storedLocale.value + + function setLocale(newLocale) { + locale.value = newLocale + storedLocale.value = newLocale + } + + return { + locale: storedLocale, + setLocale + } + } +) \ No newline at end of file diff --git a/frontend/src/stores/userProfileStore.js b/frontend/src/stores/userProfileStore.js index 929ace1..ab119a8 100644 --- a/frontend/src/stores/userProfileStore.js +++ b/frontend/src/stores/userProfileStore.js @@ -65,6 +65,7 @@ export const useUserProfileStore = defineStore( async function changeFullname(firstname, lastname) { try { + const client = useClient() await client.post( `/api/users/fullname`, { @@ -80,6 +81,7 @@ export const useUserProfileStore = defineStore( async function changeAlias(alias) { try { + const client = useClient() await client.post( `/api/users/alias`, { @@ -93,6 +95,7 @@ export const useUserProfileStore = defineStore( async function changeBirthday(birthdate) { try { + const client = useClient() await client.post( `/api/users/birthdate`, { @@ -106,6 +109,7 @@ export const useUserProfileStore = defineStore( async function changePhone(phoneNumber) { try { + const client = useClient() await client.post( `/api/users/phone`, { @@ -119,6 +123,7 @@ export const useUserProfileStore = defineStore( async function changeEmail(email) { try { + const client = useClient() await client.post( `/api/users/email`, { @@ -132,6 +137,7 @@ export const useUserProfileStore = defineStore( async function changeAddress(address) { try { + const client = useClient() await client.post( `/api/users/address`, { @@ -145,6 +151,7 @@ export const useUserProfileStore = defineStore( async function changePortrait(selectedFile) { try { + const client = useClient() const formData = new FormData(); formData.append('file', selectedFile) diff --git a/frontend/src/translations/common.en.json b/frontend/src/translations/common.en.json new file mode 100644 index 0000000..d0d72d7 --- /dev/null +++ b/frontend/src/translations/common.en.json @@ -0,0 +1,15 @@ +{ + "save": "Save", + "cancel": "Cancel", + "edit": "Edit", + "delete": "Delete", + "create": "Create", + "apply": "Apply", + "preview": "Preview", + "label": "Label", + "errors": { + "unexpected": "An unexpected error occurred", + "imageLoad": "Error loading image", + "imageUpload": "Error uploading image" + } +} \ No newline at end of file diff --git a/frontend/src/translations/common.es.json b/frontend/src/translations/common.es.json new file mode 100644 index 0000000..56489be --- /dev/null +++ b/frontend/src/translations/common.es.json @@ -0,0 +1,15 @@ +{ + "save": "Guardar", + "cancel": "Cancelar", + "edit": "Editar", + "delete": "Eliminar", + "create": "Crear", + "apply": "Aplicar", + "preview": "Vista previa", + "label": "Etiqueta", + "errors": { + "unexpected": "Se produjo un error inesperado", + "imageLoad": "Error al cargar la imagen", + "imageUpload": "Error al subir la imagen" + } +} \ No newline at end of file diff --git a/frontend/src/translations/common.fr.json b/frontend/src/translations/common.fr.json new file mode 100644 index 0000000..a88a51e --- /dev/null +++ b/frontend/src/translations/common.fr.json @@ -0,0 +1,15 @@ +{ + "save": "Enregistrer", + "cancel": "Annuler", + "edit": "Modifier", + "delete": "Supprimer", + "create": "Créer", + "apply": "Appliquer", + "preview": "Aperçu", + "label": "Étiquette", + "errors": { + "unexpected": "Une erreur inattendue s'est produite", + "imageLoad": "Erreur lors du chargement de l'image", + "imageUpload": "Erreur lors du téléchargement de l'image" + } +} \ No newline at end of file diff --git a/frontend/src/translations/translations.js b/frontend/src/translations/translations.js new file mode 100644 index 0000000..8091fe4 --- /dev/null +++ b/frontend/src/translations/translations.js @@ -0,0 +1,95 @@ +import { ref, computed, watch } from 'vue' +import { useI18n } from 'vue-i18n' + +// Helper function to get component path from stack trace +function getComponentPath() { + const stack = new Error().stack + const stackLines = stack.split('\n') + + // Find the first line that contains a .vue file + const vueFileLine = stackLines.find(line => line.includes('.vue')) + if (!vueFileLine) return null + + // Extract the file path + const match = vueFileLine.match(/\/src\/(.*?\.vue)/) + if (!match) return null + + // Return the full path without the .vue extension + return match[1].replace(/\.vue$/, '') +} + +// Helper function to get nested value from an object using dot notation +function getNestedValue(obj, path) { + return path.split('.').reduce((current, key) => { + return current && current[key] !== undefined ? current[key] : null + }, obj) +} + +export function useTranslations() { + const { locale } = useI18n() + const componentPath = ref(getComponentPath()) + const componentTranslations = ref({}) + const commonTranslations = ref({}) + + // Load translations when locale changes + const loadTranslations = async () => { + // Load component translations + if (componentPath.value) { + try { + // The translation files are in the same directory as the Vue components + const importPath = `../${componentPath.value}.${locale.value}.json` + const translations = await import(importPath) + componentTranslations.value = translations.default + } catch (e) { + try { + const importPath = `../${componentPath.value}.en.json` + const translations = await import(importPath) + componentTranslations.value = translations.default + } catch (e) { + componentTranslations.value = {} + } + } + } + + // Load common translations + try { + const importPath = `./common.${locale.value}.json` + const translations = await import(importPath) + commonTranslations.value = translations.default + } catch (e) { + try { + const importPath = './common.en.json' + const translations = await import(importPath) + commonTranslations.value = translations.default + } catch (e) { + commonTranslations.value = {} + } + } + } + + // Load translations immediately + loadTranslations() + + // Watch for locale changes + watch(locale, () => { + loadTranslations() + }) + + // Return synchronous translation function + return (key) => { + // Try to get the translation from component translations first + const componentValue = getNestedValue(componentTranslations.value, key) + if (componentValue !== null) { + return componentValue + } + + // Then try common translations + const commonValue = getNestedValue(commonTranslations.value, key) + if (commonValue !== null) { + return commonValue + } + + // If not found, return the key with MISSING prefix + return `MISSING: ${key}` + } +} \ No newline at end of file diff --git a/frontend/src/views/LoginView.en.json b/frontend/src/views/LoginView.en.json new file mode 100644 index 0000000..3017fea --- /dev/null +++ b/frontend/src/views/LoginView.en.json @@ -0,0 +1,4 @@ +{ + "title": "Login", + "alt": "hutopy login" +} \ No newline at end of file diff --git a/frontend/src/views/LoginView.es.json b/frontend/src/views/LoginView.es.json new file mode 100644 index 0000000..9d5c514 --- /dev/null +++ b/frontend/src/views/LoginView.es.json @@ -0,0 +1,4 @@ +{ + "title": "Iniciar sesión", + "alt": "iniciar sesión hutopy" +} \ No newline at end of file diff --git a/frontend/src/views/LoginView.fr.json b/frontend/src/views/LoginView.fr.json new file mode 100644 index 0000000..3a95b47 --- /dev/null +++ b/frontend/src/views/LoginView.fr.json @@ -0,0 +1,4 @@ +{ + "title": "Connexion", + "alt": "connexion hutopy" +} \ No newline at end of file diff --git a/frontend/src/views/LoginView.vue b/frontend/src/views/LoginView.vue index 6df3775..a007597 100644 --- a/frontend/src/views/LoginView.vue +++ b/frontend/src/views/LoginView.vue @@ -2,11 +2,9 @@ import {ref} from 'vue'; import {GoogleLogin} from "vue3-google-login"; import {useAuthStore} from '@/stores/authStore.js'; +import {useTranslations} from '@/translations/translations'; -import {useFacebookLogin} from "@/composables/useFacebookLogin"; -import Facebook from "@/views/svg/Facebook.vue"; - -const {loginWithFacebook} = useFacebookLogin(); +const t = useTranslations(); const authStore = useAuthStore(); @@ -22,21 +20,14 @@ async function googleCallback(token) { diff --git a/frontend/src/views/PaymentCompleted.en.json b/frontend/src/views/PaymentCompleted.en.json new file mode 100644 index 0000000..7cf21c1 --- /dev/null +++ b/frontend/src/views/PaymentCompleted.en.json @@ -0,0 +1,7 @@ +{ + "title": "Payment Successful!", + "message": "Your payment has been processed successfully.", + "usernameDefault": "the creator", + "receipt": "A receipt has been sent to your email.", + "continue": "Continue to" +} \ No newline at end of file diff --git a/frontend/src/views/PaymentCompleted.es.json b/frontend/src/views/PaymentCompleted.es.json new file mode 100644 index 0000000..6f89cda --- /dev/null +++ b/frontend/src/views/PaymentCompleted.es.json @@ -0,0 +1,7 @@ +{ + "title": "¡Pago exitoso!", + "message": "Su pago ha sido procesado con éxito.", + "usernameDefault": "el creador", + "receipt": "Se ha enviado un recibo a su correo electrónico.", + "continue": "Continuar a" +} \ No newline at end of file diff --git a/frontend/src/views/PaymentCompleted.fr.json b/frontend/src/views/PaymentCompleted.fr.json new file mode 100644 index 0000000..47c33ce --- /dev/null +++ b/frontend/src/views/PaymentCompleted.fr.json @@ -0,0 +1,7 @@ +{ + "title": "Paiement réussi !", + "message": "Votre paiement a été traité avec succès.", + "usernameDefault": "le créateur", + "receipt": "Un reçu a été envoyé à votre adresse e-mail.", + "continue": "Continuer vers" +} \ No newline at end of file diff --git a/frontend/src/views/PaymentCompleted.vue b/frontend/src/views/PaymentCompleted.vue index 2f6306c..3a1b81d 100644 --- a/frontend/src/views/PaymentCompleted.vue +++ b/frontend/src/views/PaymentCompleted.vue @@ -3,7 +3,7 @@

- {{ $t('paymentConfirmation.success.title') }} + {{ t('title') }}

@@ -13,28 +13,28 @@

- {{ $t('paymentConfirmation.success.message') }} + {{ t('message') }} {{ creatorUserName }} - {{ $t('paymentConfirmation.success.usernameDefault') }} + {{ t('usernameDefault') }}

- {{ $t('paymentConfirmation.success.receipt') }} + {{ t('receipt') }}

@@ -44,25 +44,21 @@ diff --git a/frontend/src/views/PaymentFailed.en.json b/frontend/src/views/PaymentFailed.en.json new file mode 100644 index 0000000..4420703 --- /dev/null +++ b/frontend/src/views/PaymentFailed.en.json @@ -0,0 +1,5 @@ +{ + "title": "Payment Failed", + "message": "We couldn't process your payment. Please try again or contact support if the problem persists.", + "continue": "Return to" +} \ No newline at end of file diff --git a/frontend/src/views/PaymentFailed.es.json b/frontend/src/views/PaymentFailed.es.json new file mode 100644 index 0000000..3f688c1 --- /dev/null +++ b/frontend/src/views/PaymentFailed.es.json @@ -0,0 +1,5 @@ +{ + "title": "Pago fallido", + "message": "No pudimos procesar su pago. Por favor, inténtelo de nuevo o contacte con soporte si el problema persiste.", + "continue": "Volver a" +} \ No newline at end of file diff --git a/frontend/src/views/PaymentFailed.fr.json b/frontend/src/views/PaymentFailed.fr.json new file mode 100644 index 0000000..9027faf --- /dev/null +++ b/frontend/src/views/PaymentFailed.fr.json @@ -0,0 +1,5 @@ +{ + "title": "Échec du paiement", + "message": "Nous n'avons pas pu traiter votre paiement. Veuillez réessayer ou contacter le support si le problème persiste.", + "continue": "Retourner à" +} \ No newline at end of file diff --git a/frontend/src/views/PaymentFailed.vue b/frontend/src/views/PaymentFailed.vue index ca06480..f2e1f66 100644 --- a/frontend/src/views/PaymentFailed.vue +++ b/frontend/src/views/PaymentFailed.vue @@ -1,29 +1,11 @@ \ No newline at end of file diff --git a/frontend/src/views/profile/account/AddressDialog.en.json b/frontend/src/views/profile/account/AddressDialog.en.json new file mode 100644 index 0000000..bc004ee --- /dev/null +++ b/frontend/src/views/profile/account/AddressDialog.en.json @@ -0,0 +1,4 @@ +{ + "title": "Address", + "label": "Your address" +} \ No newline at end of file diff --git a/frontend/src/views/profile/account/AddressDialog.es.json b/frontend/src/views/profile/account/AddressDialog.es.json new file mode 100644 index 0000000..e85c655 --- /dev/null +++ b/frontend/src/views/profile/account/AddressDialog.es.json @@ -0,0 +1,4 @@ +{ + "title": "Dirección", + "label": "Tu dirección" +} \ No newline at end of file diff --git a/frontend/src/views/profile/account/AddressDialog.fr.json b/frontend/src/views/profile/account/AddressDialog.fr.json new file mode 100644 index 0000000..5bf8304 --- /dev/null +++ b/frontend/src/views/profile/account/AddressDialog.fr.json @@ -0,0 +1,4 @@ +{ + "title": "Adresse", + "label": "Votre adresse" +} \ No newline at end of file diff --git a/frontend/src/views/profile/account/AddressDialog.vue b/frontend/src/views/profile/account/AddressDialog.vue index d39ecca..fde7034 100644 --- a/frontend/src/views/profile/account/AddressDialog.vue +++ b/frontend/src/views/profile/account/AddressDialog.vue @@ -1,31 +1,33 @@  \ No newline at end of file diff --git a/frontend/src/views/profile/account/PhoneDialog.en.json b/frontend/src/views/profile/account/PhoneDialog.en.json new file mode 100644 index 0000000..86d83b2 --- /dev/null +++ b/frontend/src/views/profile/account/PhoneDialog.en.json @@ -0,0 +1,4 @@ +{ + "title": "Phone Number", + "label": "Your phone number" +} \ No newline at end of file diff --git a/frontend/src/views/profile/account/PhoneDialog.es.json b/frontend/src/views/profile/account/PhoneDialog.es.json new file mode 100644 index 0000000..e322074 --- /dev/null +++ b/frontend/src/views/profile/account/PhoneDialog.es.json @@ -0,0 +1,4 @@ +{ + "title": "Número de teléfono", + "label": "Tu número de teléfono" +} \ No newline at end of file diff --git a/frontend/src/views/profile/account/PhoneDialog.fr.json b/frontend/src/views/profile/account/PhoneDialog.fr.json new file mode 100644 index 0000000..5866fde --- /dev/null +++ b/frontend/src/views/profile/account/PhoneDialog.fr.json @@ -0,0 +1,4 @@ +{ + "title": "Numéro de téléphone", + "label": "Votre numéro de téléphone" +} \ No newline at end of file diff --git a/frontend/src/views/profile/account/PhoneDialog.vue b/frontend/src/views/profile/account/PhoneDialog.vue index 78862f0..adfc2cd 100644 --- a/frontend/src/views/profile/account/PhoneDialog.vue +++ b/frontend/src/views/profile/account/PhoneDialog.vue @@ -1,32 +1,33 @@  \ No newline at end of file diff --git a/frontend/src/views/profile/creators/ChangeNameDialog.en.json b/frontend/src/views/profile/creators/ChangeNameDialog.en.json new file mode 100644 index 0000000..0986658 --- /dev/null +++ b/frontend/src/views/profile/creators/ChangeNameDialog.en.json @@ -0,0 +1,4 @@ +{ + "title": "Change Name", + "label": "Your name" +} \ No newline at end of file diff --git a/frontend/src/views/profile/creators/ChangeNameDialog.es.json b/frontend/src/views/profile/creators/ChangeNameDialog.es.json new file mode 100644 index 0000000..06a5c10 --- /dev/null +++ b/frontend/src/views/profile/creators/ChangeNameDialog.es.json @@ -0,0 +1,4 @@ +{ + "title": "Cambiar Nombre", + "label": "Tu nombre" +} \ No newline at end of file diff --git a/frontend/src/views/profile/creators/ChangeNameDialog.fr.json b/frontend/src/views/profile/creators/ChangeNameDialog.fr.json new file mode 100644 index 0000000..12d1f17 --- /dev/null +++ b/frontend/src/views/profile/creators/ChangeNameDialog.fr.json @@ -0,0 +1,4 @@ +{ + "title": "Modifier le Nom", + "label": "Votre nom" +} \ No newline at end of file diff --git a/frontend/src/views/profile/creators/ChangeNameDialog.vue b/frontend/src/views/profile/creators/ChangeNameDialog.vue index c912454..a156666 100644 --- a/frontend/src/views/profile/creators/ChangeNameDialog.vue +++ b/frontend/src/views/profile/creators/ChangeNameDialog.vue @@ -1,7 +1,9 @@