diff --git a/components.d.ts b/components.d.ts index c9af6c8..c09543c 100644 --- a/components.d.ts +++ b/components.d.ts @@ -198,6 +198,7 @@ declare module '@vue/runtime-core' { PdfTools: typeof import('./src/tools/pdf-tools/pdf-tools.vue')['default'] PercentageCalculator: typeof import('./src/tools/percentage-calculator/percentage-calculator.vue')['default'] PhoneParserAndFormatter: typeof import('./src/tools/phone-parser-and-formatter/phone-parser-and-formatter.vue')['default'] + PinyinConverter: typeof import('./src/tools/pinyin-converter/pinyin-converter.vue')['default'] 'Pricing.page': typeof import('./src/pages/Pricing.page.vue')['default'] QrCodeGenerator: typeof import('./src/tools/qr-code-generator/qr-code-generator.vue')['default'] RandomPortGenerator: typeof import('./src/tools/random-port-generator/random-port-generator.vue')['default'] diff --git a/docker/it-tools-relay/server.py b/docker/it-tools-relay/server.py index 06852af..e716a65 100644 --- a/docker/it-tools-relay/server.py +++ b/docker/it-tools-relay/server.py @@ -44,7 +44,7 @@ AUTH_PASS = os.environ.get("AUTH_PASS", "") PROJECT_NAME = os.environ.get("PROJECT_NAME", "IT-Tools") TRIAL_FILE = os.environ.get("TRIAL_FILE", "/app/data/trials.json") TRIAL_MS = int(os.environ.get("TRIAL_MS_MIN", "30")) * 60 * 1000 -PROTECTED_TOOLS = {"translator", "image-ocr", "pdf-ocr", "ai-retouch", "label-designer", "doc-convert", "image-tools", "pdf-tools", "video-tools", "audio-tools", "seal-maker", "signature-pad", "text-to-image", "zh-convert"} +PROTECTED_TOOLS = {"translator", "image-ocr", "pdf-ocr", "ai-retouch", "label-designer", "doc-convert", "image-tools", "pdf-tools", "video-tools", "audio-tools", "seal-maker", "signature-pad", "text-to-image", "zh-convert", "pinyin-converter"} MACHINE_RE = re.compile(r"^\d{10,16}$") # verify() messages that unconditionally block activation diff --git a/locales/en.yml b/locales/en.yml index 1bb69fe..7b56d56 100644 --- a/locales/en.yml +++ b/locales/en.yml @@ -275,6 +275,9 @@ tools: title: Image OCR description: Extract text from images with OCR - click, drag & drop or paste a screenshot, get recognized lines with confidence scores, copy or download as TXT. + pinyin-converter: + title: 'Pinyin converter' + description: 'Convert Chinese characters to pinyin with tones, intelligent polyphonic character handling' zh-convert: title: 'Chinese converter' description: 'Convert between Simplified and Traditional Chinese (OpenCC dictionaries), load TXT, copy or download' diff --git a/locales/zh.yml b/locales/zh.yml index a4e6a12..71bd5e9 100644 --- a/locales/zh.yml +++ b/locales/zh.yml @@ -272,6 +272,9 @@ tools: title: 图片OCR文字识别 description: 上传、拖拽或粘贴截图识别图片中的文字,逐行输出识别结果和置信度,支持复制全部和下载TXT。 + pinyin-converter: + title: '汉字转拼音' + description: '汉字转拼音(pinyin-pro 词典),带声调/数字/无声调三种风格,多音字智能转换与全读音标注,原文可选显示' zh-convert: title: '简繁体转换' description: '简体与繁体中文互转(台湾/香港标准,OpenCC 字典),支持打开 TXT、复制与下载结果' diff --git a/package.json b/package.json index 3666092..e587534 100644 --- a/package.json +++ b/package.json @@ -93,6 +93,7 @@ "pdf-signature-reader": "^1.4.2", "pdfjs-dist": "3.11.174", "pinia": "^2.0.34", + "pinyin-pro": "^3.29.5", "plausible-tracker": "^0.3.8", "qrcode": "^1.5.1", "randexp": "^0.5.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b8f63ec..47f44ea 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -179,6 +179,9 @@ importers: pinia: specifier: ^2.0.34 version: 2.0.34(typescript@5.2.2)(vue@3.3.4) + pinyin-pro: + specifier: ^3.29.5 + version: 3.29.5 plausible-tracker: specifier: ^0.3.8 version: 0.3.8 @@ -4783,6 +4786,9 @@ packages: typescript: optional: true + pinyin-pro@3.29.5: + resolution: {integrity: sha512-Fk5YoRmtdHqJWqAuzYVG/NzvzeCbaG+ZEwbY6Nbps3QAIrvQQEtcm49frcyCM8i2b5najnzPDtYqrHRYTTiuwQ==} + pkg-types@1.0.3: resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} @@ -11358,6 +11364,8 @@ snapshots: optionalDependencies: typescript: 5.2.2 + pinyin-pro@3.29.5: {} + pkg-types@1.0.3: dependencies: jsonc-parser: 3.2.0 diff --git a/src/tools/index.ts b/src/tools/index.ts index 78ab313..412739a 100644 --- a/src/tools/index.ts +++ b/src/tools/index.ts @@ -87,6 +87,7 @@ import { tool as sealMaker } from './seal-maker'; import { tool as signaturePad } from './signature-pad'; import { tool as textToImage } from './text-to-image'; import { tool as zhConvert } from './zh-convert'; +import { tool as pinyinConverter } from './pinyin-converter'; import { tool as docConvert } from './doc-convert'; import { tool as aiRetouch } from './ai-retouch'; import { tool as wifiQrCodeGenerator } from './wifi-qr-code-generator'; @@ -203,6 +204,7 @@ export const toolsByCategory: ToolCategory[] = [ asciiTextDrawer, translator, zhConvert, + pinyinConverter, ], }, { diff --git a/src/tools/license/license.ts b/src/tools/license/license.ts index 86c3105..9523bde 100644 --- a/src/tools/license/license.ts +++ b/src/tools/license/license.ts @@ -20,6 +20,7 @@ export const PROTECTED_TOOLS: Record = { '/signature-pad': '手写签名', '/text-to-image': '文字生成图片', '/zh-convert': '简繁转换', + '/pinyin-converter': '拼音转换', }; export const TRIAL_MS = 30 * 60 * 1000; // 每个功能免费 30 分钟 diff --git a/src/tools/pinyin-converter/index.ts b/src/tools/pinyin-converter/index.ts new file mode 100644 index 0000000..7dc67ac --- /dev/null +++ b/src/tools/pinyin-converter/index.ts @@ -0,0 +1,12 @@ +import { LetterCase } from '@vicons/tabler'; +import { defineTool } from '../tool'; +import { translate } from '@/plugins/i18n.plugin'; + +export const tool = defineTool({ + name: translate('tools.pinyin-converter.title'), + path: '/pinyin-converter', + description: translate('tools.pinyin-converter.description'), + keywords: ['pinyin', '拼音', '汉字', '声调', '多音字', '注音'], + component: () => import('./pinyin-converter.vue'), + icon: LetterCase, +}); diff --git a/src/tools/pinyin-converter/pinyin-converter.vue b/src/tools/pinyin-converter/pinyin-converter.vue new file mode 100644 index 0000000..a70919f --- /dev/null +++ b/src/tools/pinyin-converter/pinyin-converter.vue @@ -0,0 +1,310 @@ + + +