This commit is contained in:
Abot Yann 2024-04-11 23:28:02 +02:00 committed by GitHub
commit ebcf8b14fb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 51 additions and 9 deletions

View file

@ -0,0 +1,15 @@
tools:
token-generator:
title: 'Token 生成器'
description: '生成随机字符串,包含大写字母、小写字母、数字、字符'
uppercase: '大写字母(ABC...)'
lowercase: '小写字母(abc...)'
numbers: '数字(123...)'
symbols: '符号(!-;...)'
length: '长度'
tokenPlaceholder: 'Token...'
copied: '已复制到剪贴板'
button:
copy: '复制'
refresh: '刷新'

View file

@ -0,0 +1,13 @@
tools:
uuid-generator:
title: 'UUIDs generator'
description: 'A Universally Unique Identifier (UUID) is a 128-bit number used to identify information in computer systems. The number of possible UUIDs is 16^32, which is 2^128 or about 3.4x10^38 (which is a lot!).'
invalid-message: 'Invalid UUID'
version: 'UUID version'
quantity: 'UUID quantity'
namespace: 'Namespace'
name: 'Name'
button:
copy: Copy
refresh: Refresh

View file

@ -0,0 +1,13 @@
tools:
uuid-generator:
title: 'UUID 生成器'
description: '通用唯一标识符 (UUID) 是一个128位数字用于识别计算机系统中的信息。UUID 数量为 16^32即 2^128 或大约 3.4x10^38天文数字。'
invalid-message: 'UUID 错误'
version: '版本'
quantity: '数量'
namespace: '命名空间'
name: '名称'
button:
copy: '复制'
refresh: '刷新'

View file

@ -9,10 +9,11 @@ const versions = ['NIL', 'v1', 'v3', 'v4', 'v5'] as const;
const version = useStorage<typeof versions[number]>('uuid-generator:version', 'v4');
const count = useStorage('uuid-generator:quantity', 1);
const v35Args = ref({ namespace: '6ba7b811-9dad-11d1-80b4-00c04fd430c8', name: '' });
const { t } = useI18n();
const validUuidRules = [
{
message: 'Invalid UUID',
message: t('tools.ulid-generator.invalid-message'),
validator: (value: string) => {
if (value === nilUuid) {
return true;
@ -47,11 +48,11 @@ const { copy } = useCopy({ source: uuids, text: 'UUIDs copied to the clipboard'
<template>
<div>
<c-buttons-select v-model:value="version" :options="versions" label="UUID version" label-width="100px" mb-2 />
<c-buttons-select v-model:value="version" :options="versions" :label="t('tools.uuid-generator.version')" label-width="100px" mb-2 />
<div mb-2 flex items-center>
<span w-100px>Quantity </span>
<n-input-number v-model:value="count" flex-1 :min="1" :max="50" placeholder="UUID quantity" />
<span w-100px>{{ t('tools.uuid-generator.quantity') }} </span>
<n-input-number v-model:value="count" flex-1 :min="1" :max="50" :placeholder="t('tools.uuid-generator.quantity')" />
</div>
<div v-if="version === 'v3' || version === 'v5'">
@ -64,7 +65,7 @@ const { copy } = useCopy({ source: uuids, text: 'UUIDs copied to the clipboard'
OID: '6ba7b812-9dad-11d1-80b4-00c04fd430c8',
X500: '6ba7b814-9dad-11d1-80b4-00c04fd430c8',
}"
label="Namespace"
:label="t('tools.uuid-generator.namespace')"
label-width="100px"
mb-2
/>
@ -83,8 +84,8 @@ const { copy } = useCopy({ source: uuids, text: 'UUIDs copied to the clipboard'
<c-input-text
v-model:value="v35Args.name"
placeholder="Name"
label="Name"
:placeholder="t('tools.uuid-generator.name')"
:label="t('tools.uuid-generator.name')"
label-width="100px"
label-position="left"
mb-2
@ -107,10 +108,10 @@ const { copy } = useCopy({ source: uuids, text: 'UUIDs copied to the clipboard'
<div flex justify-center gap-3>
<c-button autofocus @click="copy()">
Copy
{{ t('tools.uuid-generator.button.copy') }}
</c-button>
<c-button @click="refreshUUIDs">
Refresh
{{ t('tools.uuid-generator.button.refresh') }}
</c-button>
</div>
</div>