WIP(translate): translate two category all tools

This commit is contained in:
Amery2010 2024-02-19 17:38:30 +08:00
parent 9db4b41daf
commit 4f550a9499
58 changed files with 708 additions and 172 deletions

View file

@ -1,10 +1,11 @@
import { List } from '@vicons/tabler';
import { defineTool } from '../tool';
import { translate as t } from '@/plugins/i18n.plugin';
export const tool = defineTool({
name: 'JSON to CSV',
name: t('tools.json-to-csv.title'),
path: '/json-to-csv',
description: 'Convert JSON to CSV with automatic header detection.',
description: t('tools.json-to-csv.description'),
keywords: ['json', 'to', 'csv', 'convert'],
component: () => import('./json-to-csv.vue'),
icon: List,

View file

@ -13,19 +13,20 @@ function transformer(value: string) {
}, '');
}
const { t } = useI18n();
const rules: UseValidationRule<string>[] = [
{
validator: (v: string) => v === '' || JSON5.parse(v),
message: 'Provided JSON is not valid.',
message: t('tools.json-to-csv.invalidMessage'),
},
];
</script>
<template>
<format-transformer
input-label="Your raw JSON"
input-placeholder="Paste your raw JSON here..."
output-label="CSV version of your JSON"
:input-label="t('tools.json-to-csv.inputLabel')"
:input-placeholder="t('tools.json-to-csv.inputPlaceholder')"
:output-label="t('tools.json-to-csv.outputLabel')"
:input-validation-rules="rules"
:transformer="transformer"
/>

View file

@ -0,0 +1,10 @@
tools:
json-to-csv:
title: JSON to CSV
description: Convert JSON to CSV with automatic header detection.
inputLabel: Your raw JSON
inputPlaceholder: Paste your raw JSON here...
outputLabel: CSV version of your JSON
invalidMessage: Provided JSON is not valid.

View file

@ -0,0 +1,10 @@
tools:
json-to-csv:
title: JSON 转换为 CSV
description: 将 JSON 转换为 CSV并自动检测标题。
inputLabel: 您的原始 JSON
inputPlaceholder: 在此粘贴您的原始 JSON...
outputLabel: 您的 JSON 的 CSV 版本
invalidMessage: 提供的 JSON 不是有效的。