Skip to content

Commit

Permalink
feat(i18n): token generator (#688)
Browse files Browse the repository at this point in the history
  • Loading branch information
motui authored Oct 23, 2023
1 parent 00562ed commit 02e68d3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/tools/token-generator/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ArrowsShuffle } from '@vicons/tabler';
import { defineTool } from '../tool';
import { translate } from '@/plugins/i18n.plugin';

export const tool = defineTool({
name: 'Token generator',
name: translate('tools.token-generator.title'),
path: '/token-generator',
description:
'Generate random string with the chars you want: uppercase or lowercase letters, numbers and/or symbols.',
description: translate('tools.token-generator.description'),
keywords: ['token', 'random', 'string', 'alphanumeric', 'symbols', 'number', 'letters', 'lowercase', 'uppercase'],
component: () => import('./token-generator.tool.vue'),
icon: ArrowsShuffle,
Expand Down
8 changes: 7 additions & 1 deletion src/tools/token-generator/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ tools:
uppercase: Uppercase (ABC...)
lowercase: Lowercase (abc...)
numbers: Numbers (123...)
symbols: Symbols (!-;...)
symbols: Symbols (!-;...)
length: Length
tokenPlaceholder: 'The token...'
copied: Token copied to the clipboard
button:
copy: Copy
refresh: Refresh
10 changes: 5 additions & 5 deletions src/tools/token-generator/token-generator.tool.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const [token, refreshToken] = computedRefreshable(() =>
}),
);
const { copy } = useCopy({ source: token, text: 'Token copied to the clipboard' });
const { copy } = useCopy({ source: token, text: t('tools.token-generator.copied') });
</script>

<template>
Expand Down Expand Up @@ -51,14 +51,14 @@ const { copy } = useCopy({ source: token, text: 'Token copied to the clipboard'
</div>
</n-form>

<n-form-item :label="`Length (${length})`" label-placement="left">
<n-form-item :label="`${t('tools.token-generator.length')} (${length})`" label-placement="left">
<n-slider v-model:value="length" :step="1" :min="1" :max="512" />
</n-form-item>

<c-input-text
v-model:value="token"
multiline
placeholder="The token..."
:placeholder="t('tools.token-generator.tokenPlaceholder')"
readonly
rows="3"
autosize
Expand All @@ -67,10 +67,10 @@ const { copy } = useCopy({ source: token, text: 'Token copied to the clipboard'

<div mt-5 flex justify-center gap-3>
<c-button @click="copy()">
Copy
{{ t('tools.token-generator.button.copy') }}
</c-button>
<c-button @click="refreshToken">
Refresh
{{ t('tools.token-generator.button.refresh') }}
</c-button>
</div>
</c-card>
Expand Down

0 comments on commit 02e68d3

Please sign in to comment.