mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-05 13:57:10 -04:00
feat(i18n): uuids generator
This commit is contained in:
parent
4b94bcc1f3
commit
e61ffe209d
3 changed files with 36 additions and 9 deletions
13
src/tools/uuid-generator/locales/en.yml
Normal file
13
src/tools/uuid-generator/locales/en.yml
Normal 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
|
13
src/tools/uuid-generator/locales/zh.yml
Normal file
13
src/tools/uuid-generator/locales/zh.yml
Normal 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: '刷新'
|
|
@ -9,10 +9,11 @@ const versions = ['NIL', 'v1', 'v3', 'v4', 'v5'] as const;
|
||||||
const version = useStorage<typeof versions[number]>('uuid-generator:version', 'v4');
|
const version = useStorage<typeof versions[number]>('uuid-generator:version', 'v4');
|
||||||
const count = useStorage('uuid-generator:quantity', 1);
|
const count = useStorage('uuid-generator:quantity', 1);
|
||||||
const v35Args = ref({ namespace: '6ba7b811-9dad-11d1-80b4-00c04fd430c8', name: '' });
|
const v35Args = ref({ namespace: '6ba7b811-9dad-11d1-80b4-00c04fd430c8', name: '' });
|
||||||
|
const { t } = useI18n();
|
||||||
|
|
||||||
const validUuidRules = [
|
const validUuidRules = [
|
||||||
{
|
{
|
||||||
message: 'Invalid UUID',
|
message: t('tools.ulid-generator.invalid-message'),
|
||||||
validator: (value: string) => {
|
validator: (value: string) => {
|
||||||
if (value === nilUuid) {
|
if (value === nilUuid) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -47,11 +48,11 @@ const { copy } = useCopy({ source: uuids, text: 'UUIDs copied to the clipboard'
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<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>
|
<div mb-2 flex items-center>
|
||||||
<span w-100px>Quantity </span>
|
<span w-100px>{{ t('tools.uuid-generator.quantity') }} </span>
|
||||||
<n-input-number v-model:value="count" flex-1 :min="1" :max="50" placeholder="UUID quantity" />
|
<n-input-number v-model:value="count" flex-1 :min="1" :max="50" :placeholder="t('tools.uuid-generator.quantity')" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="version === 'v3' || version === 'v5'">
|
<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',
|
OID: '6ba7b812-9dad-11d1-80b4-00c04fd430c8',
|
||||||
X500: '6ba7b814-9dad-11d1-80b4-00c04fd430c8',
|
X500: '6ba7b814-9dad-11d1-80b4-00c04fd430c8',
|
||||||
}"
|
}"
|
||||||
label="Namespace"
|
:label="t('tools.uuid-generator.namespace')"
|
||||||
label-width="100px"
|
label-width="100px"
|
||||||
mb-2
|
mb-2
|
||||||
/>
|
/>
|
||||||
|
@ -83,8 +84,8 @@ const { copy } = useCopy({ source: uuids, text: 'UUIDs copied to the clipboard'
|
||||||
|
|
||||||
<c-input-text
|
<c-input-text
|
||||||
v-model:value="v35Args.name"
|
v-model:value="v35Args.name"
|
||||||
placeholder="Name"
|
:placeholder="t('tools.uuid-generator.name')"
|
||||||
label="Name"
|
:label="t('tools.uuid-generator.name')"
|
||||||
label-width="100px"
|
label-width="100px"
|
||||||
label-position="left"
|
label-position="left"
|
||||||
mb-2
|
mb-2
|
||||||
|
@ -107,10 +108,10 @@ const { copy } = useCopy({ source: uuids, text: 'UUIDs copied to the clipboard'
|
||||||
|
|
||||||
<div flex justify-center gap-3>
|
<div flex justify-center gap-3>
|
||||||
<c-button autofocus @click="copy()">
|
<c-button autofocus @click="copy()">
|
||||||
Copy
|
{{ t('tools.uuid-generator.button.copy') }}
|
||||||
</c-button>
|
</c-button>
|
||||||
<c-button @click="refreshUUIDs">
|
<c-button @click="refreshUUIDs">
|
||||||
Refresh
|
{{ t('tools.uuid-generator.button.refresh') }}
|
||||||
</c-button>
|
</c-button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue