|
33 | 33 |
|
34 | 34 | prompt = f"""<|START_OF_TURN_TOKEN|><|SYSTEM_TOKEN|> |
35 | 35 | 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. |
37 | 37 |
|
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. |
46 | 44 | <|END_OF_TURN_TOKEN|> |
47 | 45 | <|START_OF_TURN_TOKEN|><|USER_TOKEN|> |
48 | 46 | {text_to_translate}<|END_OF_TURN_TOKEN|> |
|
61 | 59 | lines = lines[:-1] |
62 | 60 | translated_content = "\n".join(lines).strip() |
63 | 61 |
|
64 | | - |
65 | 62 | # 2. Path Correction |
66 | 63 | # Prepend ../ to relative paths |
67 | 64 | translated_content = re.sub(r'(\[.*?\]\()(?!(?:http|/|#|\.\./))', r'\1../', translated_content) |
|
0 commit comments