From 97f4f93fd3e2d238717bf912b2e214ce1290cf8b Mon Sep 17 00:00:00 2001 From: Alexandro Uc Santos Date: Sat, 1 Jun 2024 17:17:34 -0600 Subject: [PATCH] add: translations of profile & proposals --- src/components/AttachmentsModal.vue | 13 ++--- src/components/CardLoad.vue | 2 +- src/components/FormChangeEmail.vue | 39 ++++++++------- src/components/FormChangePassword.vue | 32 ++++++------ src/components/FormLoadModal.vue | 26 +++++----- src/components/ProfilePopup.vue | 6 +-- src/components/ProposalsModal.vue | 53 ++++++++++---------- src/components/VehicleInfo.vue | 23 +++++---- src/components/ui/Products.vue | 14 +++--- src/components/ui/Segments.vue | 2 +- src/i18n/en.js | 69 ++++++++++++++++++++++++-- src/i18n/es.js | 71 +++++++++++++++++++++++++-- src/views/CarriersView.vue | 12 +++-- src/views/EditProfileView.vue | 29 ++++++----- 14 files changed, 267 insertions(+), 124 deletions(-) diff --git a/src/components/AttachmentsModal.vue b/src/components/AttachmentsModal.vue index 7090d09..a44d867 100644 --- a/src/components/AttachmentsModal.vue +++ b/src/components/AttachmentsModal.vue @@ -3,6 +3,7 @@ import useAttachments from '../composables/useAttachments'; import Spiner from './ui/Spiner.vue'; import { useLoadsStore } from '../stores/loads'; + import { useI18n } from 'vue-i18n'; const loadStore = useLoadsStore(); const { getAttachmentLoad, loading, attachments } = useAttachments(); @@ -11,7 +12,7 @@ console.log('se ejcyta attach'); getAttachmentLoad(); }) - + const { t } = useI18n(); const clearLoad = () => { loadStore.openAttachmentsModal = false; loadStore.currentLoad = null; @@ -24,7 +25,7 @@ diff --git a/src/components/CardLoad.vue b/src/components/CardLoad.vue index 88b301e..41ea65c 100644 --- a/src/components/CardLoad.vue +++ b/src/components/CardLoad.vue @@ -184,7 +184,7 @@ @click="openAttachmentsModal" > - Evidencias + {{ t('evidence.evidence') }} + class="btn btn-dark btn-block" type="submit">{{ t('buttons.save') }} diff --git a/src/components/FormChangePassword.vue b/src/components/FormChangePassword.vue index 66e06b4..4de1ea3 100644 --- a/src/components/FormChangePassword.vue +++ b/src/components/FormChangePassword.vue @@ -7,6 +7,7 @@ import { useAuthStore } from '../stores/auth'; import { useRouter } from 'vue-router'; import { useNotificationsStore } from '../stores/notifications'; + import { useI18n } from 'vue-i18n'; const pwdForm = reactive({ pwd: '', @@ -24,6 +25,7 @@ const loading = ref(false) const msgError = ref(''); const msgSuccess = ref(''); + const { t } = useI18n() const hangleSave = async() => { msgError.value = ''; @@ -42,7 +44,7 @@ } const result = await recoveryPassword(data); if(result.msg === 'success' && result.data !== null) { - msgSuccess.value = 'Te enviamos un código al correo, ingresado!'; + msgSuccess.value = t('messages.sendCode') pwdForm.checksum = result.data.checksum; step.value = 2; clearMessages(); @@ -58,7 +60,7 @@ msgError.value = ''; msgSuccess.value = ''; if(pwdForm.code.length < 6) { - msgError.value = 'Ingresa código valido'; + msgError.value = t('errors.code'); clearMessages(); return; } else { @@ -81,7 +83,7 @@ }); clearMessages(); notifications.$patch({ - text : 'Contraseña se ha cambiando exitosamente!', + text : t('messages.changePassword'), show : true, error: false }); @@ -121,9 +123,9 @@ const pass = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[a-zA-Z]).{8,}$/; if(!pass.test(pwdForm.pwd)) { - return 'Contraseña poco segura'; + return t('errors.weakPassword') } else if (pwdForm.pwd !== pwdForm.pwd2) { - return 'Las contraseñas no coinciden'; + return t('errors.matchPassword'); } else { return ''; } @@ -146,20 +148,20 @@ v-if="step === 1" >
-

Cambiar contraseña

+

{{ t('profile.changePassword') }}


- Esta acción cerrara su sesión actual y debera volver a iniciar sesión con su nueva contraseña + {{ t('profile.helpTextResetPass') }}
+ class="btn btn-dark btn-block" type="submit">{{ t('buttons.continue') }}
Volver + class="btn-text ms-2"> {{ t('buttons.back') }}
-

Te enviamos un código de verificación al correo electrónico, ingresalo para confirmar la recuperacion de contraseña. No olvides revisar en la carpeta spam

+

{{ t('login.helptextCode') }}

+ class="btn btn-dark btn-block" type="submit">{{ t('buttons.confirm') }} diff --git a/src/components/FormLoadModal.vue b/src/components/FormLoadModal.vue index 1c73371..9a7b42b 100644 --- a/src/components/FormLoadModal.vue +++ b/src/components/FormLoadModal.vue @@ -107,7 +107,7 @@ origin.city = loadStore.currentLoad.origin?.city ? { city_name: loadStore.currentLoad.origin.city } : null; origin.country = loadStore.currentLoad.origin.country; origin.postalCode = loadStore.currentLoad.origin.zipcode; - origin.ref = loadStore.currentLoad.origin.landmark; + originRef.value = loadStore.currentLoad.origin.landmark; destination.locationName = loadStore.currentLoad.destination.company_name; destination.address = loadStore.currentLoad.destination.street_address1; @@ -115,7 +115,7 @@ destination.city = loadStore.currentLoad.destination?.city ? { city_name: loadStore.currentLoad.destination.city } : null; destination.country = loadStore.currentLoad.destination.country; destination.postalCode = loadStore.currentLoad.destination.zipcode; - destination.ref = loadStore.currentLoad.destination.landmark; + destinationRef.value = loadStore.currentLoad.destination.landmark; getCoordsMap(); } @@ -146,7 +146,7 @@ origin.address = locationLoadSelected.value.address; origin.state = { state_name: locationLoadSelected.value.state }; origin.city = { city_name: locationLoadSelected.value.city }; - origin.ref = locationLoadSelected.value.description; + originRef.value = locationLoadSelected.value.description; }); watch(locationDownloadSelected, () => { @@ -154,7 +154,7 @@ destination.address = locationDownloadSelected.value.address; destination.state = { state_name: locationDownloadSelected.value.state }; destination.city = { city_name: locationDownloadSelected.value.city }; - destination.ref = locationDownloadSelected.value.description; + destinationRef.value = locationDownloadSelected.value.description; }); const getLocations = async() => { @@ -207,7 +207,7 @@ city: '', country: '', postalCode: '', - ref: '', + // ref: '', }); const destination = reactive({ @@ -217,7 +217,7 @@ city: '', country: '', postalCode: '', - ref: '', + // ref: '', }); const setLoadData = () => { @@ -236,7 +236,7 @@ state : origin.state?.state_name, city : origin.city?.city_name, country : origin?.country, - landmark : origin?.ref, + landmark : originRef.value, zipcode : origin?.postalCode, lat : originCoords.value?.lat, lng : originCoords.value?.lng @@ -247,7 +247,7 @@ state : destination.state?.state_name, city : destination.city?.city_name, country : destination?.country, - landmark : destination?.ref, + landmark : destinationRef.value, zipcode : destination?.postalCode, lat : destinationCoords.value?.lat, lng : destinationCoords.value?.lng @@ -402,7 +402,7 @@ :filled="false" name="date-load" :required="submited ? true : false" - :error="(submited && !formLoad.dateLoad) ? 'Fecha es requerida' : null" + :error="(submited && !formLoad.dateLoad) ? t('errors.date') : null" v-model:field="formLoad.dateLoad" /> @@ -524,7 +524,7 @@ type="text" :filled="false" name="ref-origin" - v-model:field="origin.ref" + v-model:field="originRef" />
@@ -594,7 +594,7 @@ type="text" :filled="false" name="ref-destination" - v-model:field="destination.ref" + v-model:field="destinationRef" />
diff --git a/src/components/ProfilePopup.vue b/src/components/ProfilePopup.vue index 191f11e..912f755 100644 --- a/src/components/ProfilePopup.vue +++ b/src/components/ProfilePopup.vue @@ -51,8 +51,8 @@ import { watch } from 'vue';

{{auth.user?.first_name}} {{ auth.user?.last_name }}

{{ auth.user?.email }}

{{ auth.user?.phone }}

-

Preferencias de usuario

-

Idioma:

+

{{ t('global.prefs') }}

+

{{ t('global.lang') }}:

Editar perfil + >{{ t('buttons.editProfile') }} diff --git a/src/components/ProposalsModal.vue b/src/components/ProposalsModal.vue index f8236a3..b22d578 100644 --- a/src/components/ProposalsModal.vue +++ b/src/components/ProposalsModal.vue @@ -6,12 +6,14 @@ import { getDateMonthDay } from '../helpers/date_formats'; import VehicleInfo from './VehicleInfo.vue'; import Swal from 'sweetalert2' -import CardEmpty from './CardEmpty.vue'; + import CardEmpty from './CardEmpty.vue'; + import { useI18n } from 'vue-i18n'; const loadsStore = useLoadsStore(); const authStore = useAuthStore(); const isLoading = ref(false); const isLoadingActions = ref(false); + const { t } = useI18n(); onMounted(() => { getProposalsData() @@ -41,7 +43,6 @@ import CardEmpty from './CardEmpty.vue'; isLoadingActions.value = true; let load = await loadsStore.updateLoad(load_id, loadData); - if(load != null) { const index = loadsStore.loads.findIndex((load) => load._id === load_id); loadsStore.loads[index] = { @@ -63,21 +64,21 @@ import CardEmpty from './CardEmpty.vue'; ...formData }; Swal.fire({ - title: "Oferta aceptada!", - text: "La oferta fue aceptada exitosamente.", + title: t('proposals.titleOfferAccept'), + text: t('proposals.msgOfferAccept'), icon: "success" }); } else { Swal.fire({ title: "Error!", - text: "No se pudo actualizar oferta, intente más tarde.", + text: t('proposals.msgErrorAcceptOffer'), icon: "error" }); } } else { Swal.fire({ title: "Error!", - text: "No se pudo aceptar oferta, intente más tarde.", + text: t('proposals.msgNotAcceptOffer'), icon: "error" }); } @@ -85,16 +86,16 @@ import CardEmpty from './CardEmpty.vue'; } - const handleCancelProposal = async(proposal) => { + const handleCancelProposal = async(proposal) => { const proposal_id = proposal._id; const load_id = proposal.load._id; const {isConfirmed} = await Swal.fire({ - title: 'Cancelar oferta!', - text: '¿Estás seguro de cancelar esta oferta?', + title: t('proposals.titleCanceModal'), + text: t('proposals.textCancelModal'), icon: 'warning', cancelButtonColor: "#d33", showCancelButton: true, - confirmButtonText: 'Si, cancelar', + confirmButtonText: t('proposals.confirmCancel'), cancelButtonText: 'No' }) if( isConfirmed ) { @@ -126,21 +127,21 @@ import CardEmpty from './CardEmpty.vue'; ...formData }; Swal.fire({ - title: "Oferta cancelada!", - text: "La oferta fue retirada exitosamente.", + title: t('proposals.msgTitleCancel'), + text: t('proposals.msgCancel'), icon: "success" }); } else { Swal.fire({ title: "Error!", - text: "No se pudo retirar oferta, intente más tarde", + text: t('proposals.msgNotCancel'), icon: "error" }); } } else { Swal.fire({ title: "Error!", - text: "Algo salio mal, intente más tarde", + text: t('errors.generic'), icon: "error" }); } @@ -155,7 +156,7 @@ import CardEmpty from './CardEmpty.vue'; diff --git a/src/components/VehicleInfo.vue b/src/components/VehicleInfo.vue index 4a3ad7c..547e8d3 100644 --- a/src/components/VehicleInfo.vue +++ b/src/components/VehicleInfo.vue @@ -1,5 +1,6 @@