Skip to content

Commit eb72790

Browse files
committed
sys prompt fix
1 parent 3bd1c12 commit eb72790

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</div>
1616

1717
> *MyGPU: Lightweight GPU Management Utility: a compact `nvidia-smi` wrapper with an elegant web dashboard.*
18-
<!-- do not translate the folloeing shields.io badge section, keep it as it is -->
18+
<!-- do not translate the following badge section, output it as it is -->
1919
![License](https://img.shields.io/badge/license-MIT-blue.svg)
2020
![Python](https://img.shields.io/badge/python-3.10%2B-blue)
2121
![Version](https://img.shields.io/badge/version-1.2.3-blue)

scripts/translate_eastern.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,18 @@
3232
# Specialized Prompt for CJK/Eastern Languages
3333
prompt = f"""<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>
3434
You are a professional technical {target_lang_name} translator.
35-
Task: Translate the README content into {target_lang_name} while preserving the exact layout, HTML, and badges.
35+
Your task is to translate the README into {target_lang_name} while strictly preserving the header and layout.
3636
37-
STRICT PROTECTION RULES:
38-
1. **Navigation Bar**: The first block `<div align="center">...</div>` is IMMUTABLE. Copy it exactly. Do NOT translate "English", "Deutsch", etc.
39-
2. **Logo**: The block `<div style="text-align:center...` is IMMUTABLE. Copy it exactly.
40-
3. **Badges**: Lines starting with `![` are IMMUTABLE CODE. Copy them character-for-character. Do NOT translate text inside `[...]` or `(...)`. Do NOT add spaces inside brackets.
41-
4. **Formatting**: Keep all HTML tags, markdown links, and emojis exactly as is.
42-
5. **Terminology**: Keep English technical terms (GPU, CLI, VRAM, Docker, CUDA) in English.
43-
6. **Context**:
37+
MANDATORY INSTRUCTIONS:
38+
1. **Start with the Header**: The output MUST begin with the exact Navigation Bar HTML and Logo HTML from the source. Do not translate or modify them.
39+
2. **Preserve Badges**: All lines starting with `![` are code/badges. Copy them exactly. Do not translate the text inside `[]` or `()`. Do NOT add spaces inside the URL parentheses.
40+
3. **Translate Content**: Translate the rest of the documentation into professional {target_lang_name}.
41+
4. **Technical Terms**: Keep terms like GPU, CLI, VRAM, SSH, Docker, API, CUDA in English.
42+
5. **Context**:
4443
- 'Enforcement' = Policy restriction (e.g., JA: 制限/強制).
4544
- 'Headless' = Server without GUI/display.
4645
- 'Agnostic' = Hardware Independence (JA: 非依存, ZH: 无关性).
47-
7. **Output**: ONLY the translated README. No code fences.
46+
6. **No Conversational Text**: Output only the final Markdown file content. No "Here is the translation" or code fences.
4847
<|END_OF_TURN_TOKEN|>
4948
<|START_OF_TURN_TOKEN|><|USER_TOKEN|>
5049
{text_to_translate}<|END_OF_TURN_TOKEN|>

scripts/translate_western.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,14 @@
3333

3434
prompt = f"""<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|>
3535
You are a professional technical {target_lang_name} translator.
36-
Task: Translate the README content into {target_lang_name} while preserving the exact layout, HTML, and badges.
36+
Your task is to translate the README into {target_lang_name} while strictly preserving the header and layout.
3737
38-
STRICT PROTECTION RULES:
39-
1. **Navigation Bar**: The first block `<div align="center">...</div>` is IMMUTABLE. Copy it exactly. Do NOT translate "English", "Deutsch", etc.
40-
2. **Logo**: The block `<div style="text-align:center...` is IMMUTABLE. Copy it exactly.
41-
3. **Badges**: Lines starting with `![` (e.g., `![License]...`) are IMMUTABLE CODE. Copy them character-for-character. Do NOT translate "License", "Python", "Version".
42-
4. **Structure**: The output MUST start with the Navigation Bar, followed by the Logo, then the Quote, then Badges.
43-
5. **Formatting**: Keep all HTML tags, markdown links, and emojis exactly as is.
44-
6. **Terminology**: Keep technical terms (GPU, CLI, VRAM, SSH, Docker, API, CUDA) in English.
45-
7. **No Talk**: Output ONLY the translated README. No code fences.
38+
MANDATORY INSTRUCTIONS:
39+
1. **Start with the Header**: The output MUST begin with the exact Navigation Bar HTML and Logo HTML from the source. Do not translate or modify them.
40+
2. **Preserve Badges**: All lines starting with `![` are code/badges. Copy them exactly. Do not translate the text inside `[]` or `()`.
41+
3. **Translate Content**: Translate the rest of the documentation into professional {target_lang_name}.
42+
4. **Technical Terms**: Keep terms like GPU, CLI, VRAM, SSH, Docker, API, CUDA in English.
43+
5. **No Conversational Text**: Output only the final Markdown file content. No "Here is the translation" or code fences.
4644
<|END_OF_TURN_TOKEN|>
4745
<|START_OF_TURN_TOKEN|><|USER_TOKEN|>
4846
{text_to_translate}<|END_OF_TURN_TOKEN|>
@@ -61,7 +59,6 @@
6159
lines = lines[:-1]
6260
translated_content = "\n".join(lines).strip()
6361

64-
6562
# 2. Path Correction
6663
# Prepend ../ to relative paths
6764
translated_content = re.sub(r'(\[.*?\]\()(?!(?:http|/|#|\.\./))', r'\1../', translated_content)

0 commit comments

Comments
 (0)