mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-05-07 06:47:13 -04:00
WIP(translate): translate converter category all tools
This commit is contained in:
parent
2ee3b01105
commit
2da11a7242
68 changed files with 716 additions and 174 deletions
|
@ -6,13 +6,15 @@ import { useDownloadFileFromBase64 } from '@/composable/downloadBase64';
|
|||
import { useValidation } from '@/composable/validation';
|
||||
import { isValidBase64 } from '@/utils/base64';
|
||||
|
||||
const { t } = useI18n();
|
||||
|
||||
const base64Input = ref('');
|
||||
const { download } = useDownloadFileFromBase64({ source: base64Input });
|
||||
const base64InputValidation = useValidation({
|
||||
source: base64Input,
|
||||
rules: [
|
||||
{
|
||||
message: 'Invalid base 64 string',
|
||||
message: t('tools.base64-file-converter.invalidMessage'),
|
||||
validator: value => isValidBase64(value.trim()),
|
||||
},
|
||||
],
|
||||
|
@ -33,7 +35,7 @@ function downloadFile() {
|
|||
|
||||
const fileInput = ref() as Ref<File>;
|
||||
const { base64: fileBase64 } = useBase64(fileInput);
|
||||
const { copy: copyFileBase64 } = useCopy({ source: fileBase64, text: 'Base64 string copied to the clipboard' });
|
||||
const { copy: copyFileBase64 } = useCopy({ source: fileBase64, text: t('tools.base64-file-converter.copied') });
|
||||
|
||||
async function onUpload(file: File) {
|
||||
if (file) {
|
||||
|
@ -43,11 +45,11 @@ async function onUpload(file: File) {
|
|||
</script>
|
||||
|
||||
<template>
|
||||
<c-card title="Base64 to file">
|
||||
<c-card :title="t('tools.base64-file-converter.base64ToFile.title')">
|
||||
<c-input-text
|
||||
v-model:value="base64Input"
|
||||
multiline
|
||||
placeholder="Put your base64 file string here..."
|
||||
:placeholder="t('tools.base64-file-converter.base64ToFile.placeholder')"
|
||||
rows="5"
|
||||
:validation="base64InputValidation"
|
||||
mb-2
|
||||
|
@ -55,18 +57,18 @@ async function onUpload(file: File) {
|
|||
|
||||
<div flex justify-center>
|
||||
<c-button :disabled="base64Input === '' || !base64InputValidation.isValid" @click="downloadFile()">
|
||||
Download file
|
||||
{{ t('tools.base64-file-converter.buttons.downloadFile') }}
|
||||
</c-button>
|
||||
</div>
|
||||
</c-card>
|
||||
|
||||
<c-card title="File to base64">
|
||||
<c-file-upload title="Drag and drop a file here, or click to select a file" @file-upload="onUpload" />
|
||||
<c-input-text :value="fileBase64" multiline readonly placeholder="File in base64 will be here" rows="5" my-2 />
|
||||
<c-card :title="t('tools.base64-file-converter.fileToBase64.title')">
|
||||
<c-file-upload :title="t('tools.base64-file-converter.fileToBase64.uploadTip')" @file-upload="onUpload" />
|
||||
<c-input-text :value="fileBase64" multiline readonly :placeholder="t('tools.base64-file-converter.fileToBase64.placeholder')" rows="5" my-2 />
|
||||
|
||||
<div flex justify-center>
|
||||
<c-button @click="copyFileBase64()">
|
||||
Copy
|
||||
{{ t('tools.base64-file-converter.buttons.copy') }}
|
||||
</c-button>
|
||||
</div>
|
||||
</c-card>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue