From 848c6574047b711b8462fac27de7d96e8fac9019 Mon Sep 17 00:00:00 2001 From: motui Date: Sun, 22 Oct 2023 13:14:25 +0800 Subject: [PATCH] feat(i18n): bcrypt --- src/tools/bcrypt/bcrypt.vue | 28 ++++++++++++++-------------- src/tools/bcrypt/index.ts | 6 +++--- src/tools/bcrypt/locales/en.yml | 26 ++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 17 deletions(-) create mode 100644 src/tools/bcrypt/locales/en.yml diff --git a/src/tools/bcrypt/bcrypt.vue b/src/tools/bcrypt/bcrypt.vue index 55c0005f..324b3947 100644 --- a/src/tools/bcrypt/bcrypt.vue +++ b/src/tools/bcrypt/bcrypt.vue @@ -4,11 +4,11 @@ import { useThemeVars } from 'naive-ui'; import { useCopy } from '@/composable/copy'; const themeVars = useThemeVars(); - +const { t } = useI18n(); const input = ref(''); const saltCount = ref(10); const hashed = computed(() => hashSync(input.value, saltCount.value)); -const { copy } = useCopy({ source: hashed, text: 'Hashed string copied to the clipboard' }); +const { copy } = useCopy({ source: hashed, text: t('tools.bcrypt.copied') }); const compareString = ref(''); const compareHash = ref(''); @@ -19,37 +19,37 @@ const compareMatch = computed(() => compareSync(compareString.value, compareHash - - + +
- Copy hash + {{ t('tools.bcrypt.hash.button.copy') }}
- + - - + + - - + + - +
- {{ compareMatch ? 'Yes' : 'No' }} + {{ compareMatch ? t('tools.bcrypt.compare.matchY') : t('tools.bcrypt.compare.matchN') }}
diff --git a/src/tools/bcrypt/index.ts b/src/tools/bcrypt/index.ts index f70a3a60..9c80c694 100644 --- a/src/tools/bcrypt/index.ts +++ b/src/tools/bcrypt/index.ts @@ -1,11 +1,11 @@ import { LockSquare } from '@vicons/tabler'; import { defineTool } from '../tool'; +import { translate } from '@/plugins/i18n.plugin'; export const tool = defineTool({ - name: 'Bcrypt', + name: translate('tools.bcrypt.title'), path: '/bcrypt', - description: - 'Hash and compare text string using bcrypt. Bcrypt is a password-hashing function based on the Blowfish cipher.', + description: translate('tools.bcrypt.description'), keywords: ['bcrypt', 'hash', 'compare', 'password', 'salt', 'round', 'storage', 'crypto'], component: () => import('./bcrypt.vue'), icon: LockSquare, diff --git a/src/tools/bcrypt/locales/en.yml b/src/tools/bcrypt/locales/en.yml new file mode 100644 index 00000000..32ddb482 --- /dev/null +++ b/src/tools/bcrypt/locales/en.yml @@ -0,0 +1,26 @@ +tools: + bcrypt: + title: 'Bcrypt' + description: 'Hash and compare text string using bcrypt. Bcrypt is a password-hashing function based on the Blowfish cipher.' + + copied: 'Hashed string copied to the clipboard' + hash: + stringLabel: 'Your string' + stringPlaceholder: 'Your string to bcrypt...' + saltLabel: 'Salt count' + saltPlaceholder: 'Salt rounds...' + button: + copy: 'Copy hash' + compare: + title: 'Compare string with hash' + stringLabel: 'Your string' + stringPlaceholder: 'Your string to compare...' + hashLabel: 'Your hash' + hashPlaceholder: 'Your hash to compare...' + matchLabel: 'Do they match' + matchY: 'Yes' + matchN: 'No' + + + +