From bb30443faa4712896e193e3f69b4c9114b8cadb0 Mon Sep 17 00:00:00 2001 From: Alexandro Uc Santos Date: Sat, 8 Jun 2024 17:26:02 -0600 Subject: [PATCH] add: finish translation feature --- src/components/CardProposal.vue | 58 ++++++++++++---------- src/components/CardVehicle.vue | 12 ++--- src/components/CreateVehicleModal.vue | 51 +++++++++---------- src/components/DriverVehicleModal.vue | 19 ++++--- src/components/Header.vue | 11 +++-- src/components/LoadDetailModal.vue | 16 +++--- src/components/MakeProposalModal.vue | 24 ++++----- src/components/StatusVehicleModal.vue | 33 +++++++------ src/composables/userSearchLoads.js | 2 - src/helpers/status.js | 16 +++--- src/i18n/en.js | 67 +++++++++++++++++++++++-- src/i18n/es.js | 71 +++++++++++++++++++++++---- src/views/SearchLoadsView.vue | 9 ++-- src/views/TrackingLoadView.vue | 6 ++- src/views/TrucksPublishedView.vue | 7 ++- 15 files changed, 269 insertions(+), 133 deletions(-) diff --git a/src/components/CardProposal.vue b/src/components/CardProposal.vue index 36e1798..b09a5e0 100644 --- a/src/components/CardProposal.vue +++ b/src/components/CardProposal.vue @@ -1,10 +1,11 @@ @@ -156,14 +157,14 @@
- + {{ errors.truck_type }}
- +
- + {{ errors.state }}
- + @@ -226,7 +227,7 @@
- +
@@ -248,7 +249,7 @@ + class="btn-primary-sm radius-sm" type="submit">{{ t('buttons.save') }}
diff --git a/src/components/DriverVehicleModal.vue b/src/components/DriverVehicleModal.vue index 04f8e7c..1423e18 100644 --- a/src/components/DriverVehicleModal.vue +++ b/src/components/DriverVehicleModal.vue @@ -4,6 +4,7 @@ import Spiner from './ui/Spiner.vue'; import { useVehiclesStore } from '../stores/vehicles'; import Swal from 'sweetalert2'; + import { useI18n } from 'vue-i18n'; const props = defineProps({ vehicle: { @@ -17,6 +18,8 @@ const companyStore = useCompanyStore(); const vehicleStore = useVehiclesStore(); + const { t } = useI18n() + const driverSelected = ref(null); const drivers = ref([]); const error = ref(null) @@ -32,7 +35,7 @@ const handleSetDriver = async() => { if(driverSelected.value === null) { - error.value = 'Seleccione un conductor'; + error.value = t('errors.driver'); return } @@ -63,7 +66,7 @@ if(result2 === 'success' ){ document.getElementById('btnCloseeditDriverVehicle').click(); Swal.fire({ - title: `Driver asignado con éxito!`, + title: `${t('vehicles.msgAssigedDriver')}`, icon: 'success' }); } else { @@ -93,7 +96,7 @@ - {{ locale }}
@@ -108,10 +106,13 @@ const closePopup = () => { display: flex; align-items: center; align-content: center; + width: 100%; /* width: 65%; */ } .box-register{ margin-left: 24px; + display: flex; + flex: 1; } .title-header{ font-size: 1.8rem; @@ -180,7 +181,7 @@ const closePopup = () => { } @media (max-width: 568px) { .logo{ - height: 80px; + height: 60px; } .title-header{ font-size: 1rem; diff --git a/src/components/LoadDetailModal.vue b/src/components/LoadDetailModal.vue index 876200d..c3fdb08 100644 --- a/src/components/LoadDetailModal.vue +++ b/src/components/LoadDetailModal.vue @@ -6,7 +6,8 @@ import useDirectionsRender from '../composables/useDirectionRender'; import Cardload from './CardLoad.vue'; import { useLoadsStore } from '../stores/loads'; -import { useNotificationsStore } from '../stores/notifications'; + import { useNotificationsStore } from '../stores/notifications'; + import { useI18n } from 'vue-i18n'; const mapKey = import.meta.env.VITE_MAP_KEY; @@ -22,6 +23,7 @@ import { useNotificationsStore } from '../stores/notifications'; const isLoadActive = ref(false); const { getDirections, geocodeAddress } = useDirectionsRender() + const { t } = useI18n(); const props = defineProps({ proposal: { @@ -59,7 +61,7 @@ import { useNotificationsStore } from '../stores/notifications'; if(addressOrigin.lat && addressOrigin.lng) { originCoords.value = {lat: Number.parseFloat(addressOrigin.lat), lng: Number.parseFloat(addressOrigin.lng)}; } else { - console.log('No hay coords origin') + // console.log('No hay coords origin') let startLocation = addressOrigin.street_address1 + ', ' + addressOrigin.city + ', ' + addressOrigin.state + ', ' + addressOrigin.country + ', ' +addressOrigin.zipcode; originCoords.value = await geocodeAddress(startLocation); } @@ -67,7 +69,7 @@ import { useNotificationsStore } from '../stores/notifications'; if(addressDestination.lat && addressDestination.lng) { destinationCoords.value = {lat: Number.parseFloat(addressDestination.lat), lng: Number.parseFloat(addressDestination.lng)}; } else { - console.log('No hay coords destinatiom') + // console.log('No hay coords destinatiom') let endLocation = addressDestination.street_address1 + ', ' + addressDestination.city + ', ' + addressDestination.state + ', ' + addressDestination.country + ', ' +addressDestination.zipcode; destinationCoords.value = await geocodeAddress(endLocation); } @@ -100,7 +102,7 @@ import { useNotificationsStore } from '../stores/notifications'; } } catch (error) { notyStore.$patch({ - text : 'No se pudo cargar mapa', + text : t('errors.map'), show : true, error: true }); @@ -128,7 +130,7 @@ import { useNotificationsStore } from '../stores/notifications';
diff --git a/src/components/MakeProposalModal.vue b/src/components/MakeProposalModal.vue index eba1fa1..23e3bc5 100644 --- a/src/components/MakeProposalModal.vue +++ b/src/components/MakeProposalModal.vue @@ -10,6 +10,7 @@ import { useVehiclesStore } from '../stores/vehicles'; // import { saveProposal } from '../services/vehicles' import Swal from 'sweetalert2'; + import { useI18n } from 'vue-i18n'; const mapKey = import.meta.env.VITE_MAP_KEY; @@ -46,6 +47,7 @@ defineEmits(['reset-load']) + const { t } = useI18n() onMounted(() => { window.addEventListener('resize', handleResize); @@ -86,13 +88,13 @@ const handleSumit = async() => { if(form.vehicle === ""){ - msgError.value = 'Selecciona vehiculo para continuar'; + msgError.value = t('errors.vehicle'); setTimeout(() => { msgError.value = ''; }, 5000); return; } else if (form.comments.trim().length <= 0) { - msgError.value = 'Agrega un comentario'; + msgError.value = t('errors.comment'); setTimeout(() => { msgError.value = ''; }, 5000); @@ -111,7 +113,7 @@ load : props.load._id } loadingSubmit.value = true; - action = 'creada'; + action = t('proposals.msgOffertDone'); result = await companyStore.createPropsal(formData); } else { let formData = { @@ -127,14 +129,14 @@ _driver: vehicleSelected?.driver.first_name + ' ' + vehicleSelected?.driver.last_name } loadingSubmit.value = true; - action = 'actualizada' + action = t('proposals.msgOffertUpdate') result = await companyStore.updatePropsalLoad(props.proposal._id, formData, localData); } if(result === 'success') { document.getElementById('btnClosemakeProposalModal').click(); Swal.fire({ - title: `Oferta ${action} con éxito!`, + title: `${action}`, icon: 'success' }) } else { @@ -146,8 +148,8 @@ loadingSubmit.value = false; } - const title = computed(() => (props.proposal) ? 'Modificar oferta' : 'Realizar oferta'); - const btnSubmit = computed(() => (props.proposal) ? 'Guardar' : 'Enviar'); + const title = computed(() => (props.proposal) ? t('proposals.modOffer') : t('proposals.makeOffer')); + const btnSubmit = computed(() => (props.proposal) ? t('buttons.save') : t('buttons.send'));