From 9ca62dc3ad045cc284d60eb584f186c2af6de219 Mon Sep 17 00:00:00 2001 From: Komek Hayytnazarov Date: Mon, 3 Oct 2022 11:59:13 +0500 Subject: [PATCH] added required field translations --- src/i18n/ru.js | 1 - src/views/login/Main.vue | 10 +++++++--- src/views/profile-forms/BankAccount.vue | 22 ++++++++++++---------- src/views/profile-forms/Business.vue | 18 ++++++++++-------- src/views/profile-forms/Company.vue | 23 ++++++++++++----------- src/views/profile-forms/Contacts.vue | 19 ++++++++++--------- 6 files changed, 51 insertions(+), 42 deletions(-) diff --git a/src/i18n/ru.js b/src/i18n/ru.js index d7f338d..2d7bbc5 100644 --- a/src/i18n/ru.js +++ b/src/i18n/ru.js @@ -113,7 +113,6 @@ export const locale = { TICKETS: "Tickets", NEW_TICKET: "New Ticket", CONTACTS: "Contracts", - SHORT_NAME: "Short Name", REQUIRED_VALIDATION: "This field is required", MIN_LENGTH_VALIDATION: "This field should be at least {min} characters long", diff --git a/src/views/login/Main.vue b/src/views/login/Main.vue index 0239fcb..4c7ee3f 100644 --- a/src/views/login/Main.vue +++ b/src/views/login/Main.vue @@ -101,12 +101,14 @@ import { onMounted, reactive, toRefs, ref } from "vue"; import dom from "@left4code/tw-starter/dist/js/dom"; import { useVuelidate } from "@vuelidate/core"; -import { required, minLength, email } from "@vuelidate/validators"; +import { required, helpers, minLength, email } from "@vuelidate/validators"; import { useAuthStore } from "@/stores"; import router from "@/router"; import Logo from "@/components/logo/Main.vue"; import Lang from "@/components/lang/Main.vue"; +const { t } = useI18n({}); + const formData = reactive({ email: "", password: "", @@ -117,13 +119,15 @@ const isForgotPwdLoading = ref(false); const rules = { email: { - required, + required: helpers.withMessage(t("REQUIRED_VALIDATION"), required), email, }, password: { required, - minLength: minLength(8), + minLength: helpers.withMessage( + t("MIN_LENGTH_VALIDATION", { min: 8 }), minLength(8) + ) }, }; diff --git a/src/views/profile-forms/BankAccount.vue b/src/views/profile-forms/BankAccount.vue index 1eaf198..a3cc147 100644 --- a/src/views/profile-forms/BankAccount.vue +++ b/src/views/profile-forms/BankAccount.vue @@ -156,7 +156,7 @@