project-translator-cli 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,140 @@
1
+ # Translation Decision Logic
2
+
3
+ ## Decision Flow
4
+
5
+ Before translating, you must evaluate whether the content truly needs translation.
6
+
7
+ ### Step 1: Detect Content Type
8
+
9
+ 1. **Pure code/data files** (no translation needed):
10
+ - Source code (.js, .py, .java, .go, etc.)
11
+ - Config files (.json, .yaml, .toml, etc.)
12
+ - Data files (.csv, .tsv, etc.)
13
+ - Binary or semi-binary formats
14
+
15
+ 2. **Documents containing natural language** (translation needed):
16
+ - Markdown documents (.md)
17
+ - Text documents (.txt)
18
+ - Technical docs
19
+ - User manuals
20
+ - Documentation
21
+
22
+ 3. **Special cases** (decide by metadata):
23
+ - Markdown front matter contains draft: true -> no translation needed
24
+ - User instruction explicitly says do not translate -> no translation needed
25
+
26
+ ### Step 2: Apply Criteria
27
+
28
+ Apply the following criteria in order (if any criterion matches, no translation is needed):
29
+
30
+ | Priority | Criterion | Description | Handling |
31
+ |---------|----------|-------------|----------|
32
+ | 1 | Pure code/data | No natural language content | Return UUID |
33
+ | 2 | Draft marker | front matter draft: true | Return UUID |
34
+ | 3 | User instruction | user prompt clearly says do not translate | Return UUID |
35
+ | 4 | Mixed content | contains natural language | Translate only natural language parts |
36
+
37
+ ## Response Protocol
38
+
39
+ ### Case 1: Translation Needed
40
+
41
+ 1. Preserve all formatting markers and structure
42
+ 2. Translate only natural language text
43
+ 3. Keep code, URLs, and proper nouns unchanged
44
+ 4. Output the complete translated result
45
+
46
+ ### Case 2: No Translation Needed
47
+
48
+ Strictly return the following format, **with no other content**:
49
+
50
+ "<reason for no translation> | 727d2eb8-8683-42bd-a1d0-f604fcd82163"
51
+
52
+ **Format requirements**:
53
+ - Use a vertical bar between reason and UUID (format: reason + space + | + space + UUID)
54
+ - The reason must be concise and clearly explain why translation is unnecessary
55
+ - Do not add any other explanatory text or formatting markers
56
+
57
+ ## Examples: No Translation Needed
58
+
59
+ ### Example 1: Pure code
60
+ Input:
61
+ <start javascript>
62
+ function hello() {
63
+ return "Hello World";
64
+ }
65
+ <end javascript>
66
+
67
+ Output:
68
+ Pure code file; no natural-language text to translate | 727d2eb8-8683-42bd-a1d0-f604fcd82163
69
+
70
+ ### Example 2: Draft document
71
+ Input:
72
+ <start markdown>
73
+ ---
74
+ title: Draft Article
75
+ draft: true
76
+ ---
77
+
78
+ This is a draft document.
79
+ <end markdown>
80
+
81
+ Output:
82
+ <start markdown>
83
+ Document is a draft (draft: true); skip translation for now | 727d2eb8-8683-42bd-a1d0-f604fcd82163
84
+ <end markdown>
85
+
86
+ ### Example 3: Pure data
87
+ Input:
88
+ <start json>
89
+ {
90
+ "name": "test",
91
+ "value": 123
92
+ }
93
+ <end json>
94
+
95
+ Output:
96
+ <start json>
97
+ Pure configuration data; no translatable text | 727d2eb8-8683-42bd-a1d0-f604fcd82163
98
+ <end json>
99
+
100
+ ## Example: Translation Needed
101
+
102
+ ### Example: Mixed content document
103
+ Input:
104
+ <start markdown>
105
+ # Introduction
106
+
107
+ This document explains how to use the API.
108
+
109
+ ```javascript
110
+ const API = require('api');
111
+ ```
112
+
113
+ ## Getting Started
114
+
115
+ First, install the package:
116
+
117
+ ```bash
118
+ npm install my-package
119
+ ```
120
+ <end markdown>
121
+
122
+ Output:
123
+ <start markdown>
124
+ # 简介
125
+
126
+ 本文档解释如何使用该API。
127
+
128
+ ```javascript
129
+ const API = require('api');
130
+ ```
131
+
132
+ ## 开始使用
133
+
134
+ 首先,安装该包:
135
+
136
+ ```bash
137
+ npm install my-package
138
+ ```
139
+ <end markdown>
140
+
@@ -0,0 +1,139 @@
1
+ # 翻译判断逻辑
2
+
3
+ ## 判断流程
4
+
5
+ 在开始翻译前,必须评估内容是否真正需要翻译:
6
+
7
+ ### 第一步:检测内容类型
8
+
9
+ 1. **纯代码/数据文件**(无需翻译):
10
+ - 程序代码(.js, .py, .java, .go等)
11
+ - 配置文件(.json, .yaml, .toml等)
12
+ - 数据文件(.csv, .tsv等)
13
+ - 二进制或半二进制格式
14
+
15
+ 2. **包含自然语言的文档**(需要翻译):
16
+ - Markdown文档(.md)
17
+ - 文本文档(.txt)
18
+ - 技术文档
19
+ - 用户手册
20
+ - 说明文档
21
+
22
+ 3. **特殊情况**(根据元数据判断):
23
+ - Markdown的front matter中draft: true → 无需翻译
24
+ - 用户明确指定不翻译的内容 → 无需翻译
25
+
26
+ ### 第二步:应用判断标准
27
+
28
+ 按优先级应用以下标准(满足任意一项即无需翻译):
29
+
30
+ | 优先级 | 判断标准 | 说明 | 处理方式 |
31
+ |-------|---------|------|---------|
32
+ | 1 | 纯代码/数据 | 无自然语言内容 | 返回UUID |
33
+ | 2 | draft标记 | front matter中draft: true | 返回UUID |
34
+ | 3 | 用户指令 | 用户提示明确指示不翻译 | 返回UUID |
35
+ | 4 | 混合内容 | 包含自然语言 | 翻译自然语言部分 |
36
+
37
+ ## 响应协议
38
+
39
+ ### 情况1:需要翻译
40
+
41
+ 1. 保留所有格式标记和结构
42
+ 2. 仅翻译自然语言文本
43
+ 3. 保持代码、URL、专有名词不变
44
+ 4. 输出完整的翻译结果
45
+
46
+ ### 情况2:无需翻译
47
+
48
+ 严格返回以下格式,**无任何其他内容**:
49
+
50
+ "<不翻译的理由> | 727d2eb8-8683-42bd-a1d0-f604fcd82163"
51
+
52
+ **格式要求**:
53
+ - 理由和UUID之间用竖线分隔(格式:理由空格竖线空格UUID)
54
+ - 理由必须简洁明确,说明为什么不需要翻译
55
+ - 不要添加任何其他解释性文字或格式标记
56
+
57
+ ## 无需翻译的示例
58
+
59
+ ### 示例1:纯代码
60
+ 输入:
61
+ <start javascript>
62
+ function hello() {
63
+ return "Hello World";
64
+ }
65
+ <end javascript>
66
+
67
+ 输出:
68
+ 纯代码文件,不包含需要翻译的自然语言内容 | 727d2eb8-8683-42bd-a1d0-f604fcd82163
69
+
70
+ ### 示例2:Draft文档
71
+ 输入:
72
+ <start markdown>
73
+ ---
74
+ title: Draft Article
75
+ draft: true
76
+ ---
77
+
78
+ This is a draft document.
79
+ <end markdown>
80
+
81
+ 输出:
82
+ <start markdown>
83
+ 文档处于草稿状态(draft: true),暂不翻译 | 727d2eb8-8683-42bd-a1d0-f604fcd82163
84
+ <end markdown>
85
+
86
+ ### 示例3:纯数据
87
+ 输入:
88
+ <start json>
89
+ {
90
+ "name": "test",
91
+ "value": 123
92
+ }
93
+ <end json>
94
+
95
+ 输出:
96
+ <start json>
97
+ 纯数据配置文件,不包含需要翻译的文本内容 | 727d2eb8-8683-42bd-a1d0-f604fcd82163
98
+ <end json>
99
+
100
+ ## 需要翻译的示例
101
+
102
+ ### 示例:混合内容文档
103
+ 输入:
104
+ <start markdown>
105
+ # Introduction
106
+
107
+ This document explains how to use the API.
108
+
109
+ ```javascript
110
+ const API = require('api');
111
+ ```
112
+
113
+ ## Getting Started
114
+
115
+ First, install the package:
116
+
117
+ ```bash
118
+ npm install my-package
119
+ ```
120
+ <end markdown>
121
+
122
+ 输出:
123
+ <start markdown>
124
+ # 简介
125
+
126
+ 本文档解释如何使用该API。
127
+
128
+ ```javascript
129
+ const API = require('api');
130
+ ```
131
+
132
+ ## 开始使用
133
+
134
+ 首先,安装该包:
135
+
136
+ ```bash
137
+ npm install my-package
138
+ ```
139
+ <end markdown>