diff --git a/src/plugins/i18n.plugin.ts b/src/plugins/i18n.plugin.ts index 7ef2c98f..c179873d 100644 --- a/src/plugins/i18n.plugin.ts +++ b/src/plugins/i18n.plugin.ts @@ -21,6 +21,7 @@ const messages = _.merge( const i18n = createI18n({ legacy: false, locale: 'en', + fallbackLocale: 'en', messages, }); @@ -32,6 +33,5 @@ export const i18nPlugin: Plugin = { export const translate = function (localeKey: string) { // @ts-expect-error global - const hasKey = i18n.global.te(localeKey, i18n.global.locale); - return hasKey ? i18n.global.t(localeKey) : localeKey; + return i18n.global.t(localeKey); }; diff --git a/src/tools/bip39-generator/bip39-generator.vue b/src/tools/bip39-generator/bip39-generator.vue index a07941b2..dba97aea 100644 --- a/src/tools/bip39-generator/bip39-generator.vue +++ b/src/tools/bip39-generator/bip39-generator.vue @@ -36,6 +36,7 @@ const languages = { const entropy = ref(generateEntropy()); const passphraseInput = ref(''); +const { t } = useI18n(); const language = ref('English'); const passphrase = computed({ @@ -53,11 +54,11 @@ const entropyValidation = useValidation({ rules: [ { validator: value => value === '' || (value.length <= 32 && value.length >= 16 && value.length % 4 === 0), - message: 'Entropy length should be >= 16, <= 32 and be a multiple of 4', + message: t('tools.bip39-generator.validation.lengthError'), }, { validator: value => /^[a-fA-F0-9]*$/.test(value), - message: 'Entropy should be an hexadecimal string', + message: t('tools.bip39-generator.validation.stringTypeError'), }, ], }); @@ -67,7 +68,7 @@ const mnemonicValidation = useValidation({ rules: [ { validator: value => isNotThrowing(() => mnemonicToEntropy(value, languages[language.value])), - message: 'Invalid mnemonic', + message: t('tools.bip39-generator.validation.mnemonicError'), }, ], }); @@ -76,8 +77,8 @@ function refreshEntropy() { entropy.value = generateEntropy(); } -const { copy: copyEntropy } = useCopy({ source: entropy, text: 'Entropy copied to the clipboard' }); -const { copy: copyPassphrase } = useCopy({ source: passphrase, text: 'Passphrase copied to the clipboard' }); +const { copy: copyEntropy } = useCopy({ source: entropy, text: t('tools.bip39-generator.copied.entropy') }); +const { copy: copyPassphrase } = useCopy({ source: passphrase, text: t('tools.bip39-generator.copied.passphrase') });