From e22bf6f497455cbf61eab8ab42845c6a11f6c904 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Tue, 15 Mar 2022 03:11:35 +0100 Subject: [PATCH] additional checks, fix dynamic $t values by ignoring our occurences --- frontend/.eslintrc.js | 7 +++++++ .../DecayInformations/DecayInformation-DecayStartblock.vue | 1 + .../components/DecayInformations/DecayInformation-Long.vue | 2 ++ frontend/src/components/UserSettings/UserLanguage.vue | 1 + frontend/src/pages/ForgotPassword.vue | 3 +++ frontend/src/pages/ResetPassword.vue | 3 +++ frontend/src/pages/thx.vue | 3 +++ frontend/src/validation-rules.js | 2 ++ 8 files changed, 22 insertions(+) diff --git a/frontend/.eslintrc.js b/frontend/.eslintrc.js index 1cd68b9b6..47bb9b440 100644 --- a/frontend/.eslintrc.js +++ b/frontend/.eslintrc.js @@ -27,6 +27,13 @@ module.exports = { allowBinding: false, }, ], + '@intlify/vue-i18n/no-dynamic-keys': 'error', + '@intlify/vue-i18n/no-unused-keys': [ + 'error', + { + extensions: ['.js', '.vue'], + }, + ], 'prettier/prettier': [ 'error', { diff --git a/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue b/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue index b7d8a42c0..03871a334 100644 --- a/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue +++ b/frontend/src/components/DecayInformations/DecayInformation-DecayStartblock.vue @@ -27,6 +27,7 @@ + {{ $t(`decay.${typeId.toLowerCase()}`) }} {{ amount | GDD }} diff --git a/frontend/src/components/DecayInformations/DecayInformation-Long.vue b/frontend/src/components/DecayInformations/DecayInformation-Long.vue index 033d73560..8eacbe72e 100644 --- a/frontend/src/components/DecayInformations/DecayInformation-Long.vue +++ b/frontend/src/components/DecayInformations/DecayInformation-Long.vue @@ -43,6 +43,7 @@ + {{ $t(`decay.${typeId.toLowerCase()}`) }} {{ amount | GDD }} @@ -81,6 +82,7 @@ export default { const result = [] order.forEach((timeSpan) => { if (this.duration[timeSpan] > 0) { + // eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys const locale = this.$t(`decay.${timeSpan}`) result.push(`${this.duration[timeSpan]} ${locale}`) } diff --git a/frontend/src/components/UserSettings/UserLanguage.vue b/frontend/src/components/UserSettings/UserLanguage.vue index 16582cdb8..50be83712 100644 --- a/frontend/src/components/UserSettings/UserLanguage.vue +++ b/frontend/src/components/UserSettings/UserLanguage.vue @@ -22,6 +22,7 @@ {{ $t('language') }} + {{ $t(buildTagFromLanguageString()) }} diff --git a/frontend/src/pages/ForgotPassword.vue b/frontend/src/pages/ForgotPassword.vue index da80e2628..f06c561a3 100644 --- a/frontend/src/pages/ForgotPassword.vue +++ b/frontend/src/pages/ForgotPassword.vue @@ -5,7 +5,9 @@
+

{{ $t(displaySetup.headline) }}

+

{{ $t(displaySetup.subtitle) }}

@@ -22,6 +24,7 @@
+ {{ $t(displaySetup.button) }}
diff --git a/frontend/src/pages/ResetPassword.vue b/frontend/src/pages/ResetPassword.vue index 40c2f5ee4..b0194c0ba 100644 --- a/frontend/src/pages/ResetPassword.vue +++ b/frontend/src/pages/ResetPassword.vue @@ -5,9 +5,11 @@
+

{{ $t(displaySetup.authenticated) }}

+ {{ $t(displaySetup.notAuthenticated) }}
@@ -26,6 +28,7 @@
+ {{ $t(displaySetup.button) }}
diff --git a/frontend/src/pages/thx.vue b/frontend/src/pages/thx.vue index fc721b63e..41c63c7d8 100644 --- a/frontend/src/pages/thx.vue +++ b/frontend/src/pages/thx.vue @@ -4,10 +4,13 @@
+

{{ $t(displaySetup.headline) }}

+

{{ $t(displaySetup.subtitle) }}


+ {{ $t(displaySetup.button) }}
diff --git a/frontend/src/validation-rules.js b/frontend/src/validation-rules.js index 59facf65e..a06eab657 100644 --- a/frontend/src/validation-rules.js +++ b/frontend/src/validation-rules.js @@ -5,7 +5,9 @@ import { required, email, min, max, is_not } from 'vee-validate/dist/rules' export const loadAllRules = (i18nCallback) => { configure({ defaultMessage: (field, values) => { + // eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys values._field_ = i18nCallback.t(`fields.${field}`) + // eslint-disable-next-line @intlify/vue-i18n/no-dynamic-keys return i18nCallback.t(`validations.messages.${values._rule_}`, values) }, classes: {