Initial commit
This commit is contained in:
11
.claude-plugin/plugin.json
Normal file
11
.claude-plugin/plugin.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "my-first-plugin",
|
||||
"description": "A simple greeting plugin to learn the basics. Also a translator plugin",
|
||||
"version": "2.0.0",
|
||||
"author": {
|
||||
"name": "Your Name"
|
||||
},
|
||||
"commands": [
|
||||
"./commands"
|
||||
]
|
||||
}
|
||||
3
README.md
Normal file
3
README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# my-first-plugin
|
||||
|
||||
A simple greeting plugin to learn the basics. Also a translator plugin
|
||||
7
commands/hello.md
Normal file
7
commands/hello.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
description: Greet the user with a personalized message
|
||||
---
|
||||
|
||||
# Hello Command
|
||||
|
||||
Greet the user warmly and ask how you can help them today. Make the greeting personal and encouraging.
|
||||
136
commands/translator.md
Normal file
136
commands/translator.md
Normal file
@@ -0,0 +1,136 @@
|
||||
---
|
||||
description: Help the user with translation
|
||||
---
|
||||
|
||||
### Command Name
|
||||
|
||||
- translator
|
||||
|
||||
### Purpose
|
||||
|
||||
- Translate provided text into a specified target language.
|
||||
- Preserve original intent, tone, register, and formatting.
|
||||
- Optionally adapt dialect, formality, and domain-specific terminology.
|
||||
|
||||
### Inputs
|
||||
|
||||
- required:
|
||||
- target_language: The language to translate into (e.g., “Spanish”, “Portuguese (Brazil)”, “English (US)”).
|
||||
- optional:
|
||||
- source_language: Auto-detect if omitted.
|
||||
- formality: “informal” | “neutral” | “formal”.
|
||||
- dialect: e.g., “en-US”, “pt-BR”, “es-ES”, “fr-CA”.
|
||||
- domain: e.g., “legal”, “medical”, “technical”, “marketing”, “UX copy”.
|
||||
- glossary: Key-value pairs that must be enforced in the translation.
|
||||
- style_notes: Free-text guidance on tone or style (e.g., “friendly, concise, product voice”).
|
||||
- keep_formatting: boolean (default true) to preserve line breaks, lists, punctuation.
|
||||
- inline_code_language: If text includes code; preserves code blocks and inline code.
|
||||
- handle_emojis: “preserve” | “localize” | “remove”.
|
||||
- output_wrapper: “plain” | “markdown” | “json”.
|
||||
- include_back_translation: boolean (default false) to include reverse translation for QA.
|
||||
- include_change_log: boolean (default false) to list notable translation decisions.
|
||||
|
||||
### Behavior
|
||||
|
||||
- Auto-detect source language if not provided; report detection if confidence is high.
|
||||
- Respect formality, dialect, and domain; default to neutral if unspecified.
|
||||
- Preserve:
|
||||
- Structure: paragraphs, lists, headings, tables, and spacing.
|
||||
- Non-translatable tokens: code, file paths, URLs, CLI flags, product names, variables, and placeholders like {name}, %s, :emoji:.
|
||||
- Glossary:
|
||||
- Enforce exact matches for keys; do not inflect or translate glossary values.
|
||||
- Disambiguation:
|
||||
- If ambiguous, ask 1 concise clarifying question; otherwise choose the most widely used interpretation and note it in the change log (if enabled).
|
||||
- Safety and appropriateness:
|
||||
- Do not add content. Do not censor unless explicitly requested.
|
||||
- For sensitive content, translate faithfully without moralizing.
|
||||
- Numbers, units, and punctuation:
|
||||
- Localize punctuation and number formats according to target dialect norms unless keep_formatting is false.
|
||||
- Emojis:
|
||||
- Follow handle_emojis behavior.
|
||||
|
||||
### Output Format
|
||||
|
||||
- When output_wrapper = “plain”: return only the translated text.
|
||||
- When output_wrapper = “markdown”: return the translation in markdown, preserving structure.
|
||||
- When output_wrapper = “json”: return a JSON object with:
|
||||
- translation: string
|
||||
- detected_source_language: string | null
|
||||
- formality: string
|
||||
- dialect: string | null
|
||||
- domain: string | null
|
||||
- glossary_applied: string[] (keys applied)
|
||||
- change_log: string[] (if include_change_log)
|
||||
- back_translation: string | null (if include_back_translation)
|
||||
|
||||
### Non-Translatable Handling
|
||||
|
||||
- Code fences and inline code remain unchanged. If comments in code need translation, translate comments only.
|
||||
- Placeholders/variables remain exact: {var}, {{handlebars}}, %(name)s, $VAR, <tags>, [links](url).
|
||||
- Product names and trademarks remain unchanged unless glossary instructs otherwise.
|
||||
|
||||
### Error Handling
|
||||
|
||||
- If target_language is missing: ask for it.
|
||||
- If glossary conflicts with grammar or context: prefer glossary and note in change_log.
|
||||
- If text is too long for a single response: ask to proceed in chunks.
|
||||
|
||||
### Examples
|
||||
|
||||
- Example 1: Simple
|
||||
|
||||
- Input:
|
||||
- target_language: “Spanish”
|
||||
- text: “Please restart the device and try again.”
|
||||
- Output (plain):
|
||||
- “Reinicia el dispositivo y vuelve a intentarlo.”
|
||||
|
||||
- Example 2: Formal + Dialect + Glossary + Markdown
|
||||
|
||||
- Input:
|
||||
- target_language: “Portuguese (Brazil)”
|
||||
- formality: “formal”
|
||||
- dialect: “pt-BR”
|
||||
- glossary: { “Support”: “Suporte”, “Workspace”: “Workspace” }
|
||||
- output_wrapper: “markdown”
|
||||
- text:
|
||||
"""
|
||||
# Getting started
|
||||
Contact Support to access your Workspace.
|
||||
"""
|
||||
- Output (markdown):
|
||||
"""
|
||||
# Introdução
|
||||
Entre em contato com o Suporte para acessar seu Workspace.
|
||||
"""
|
||||
|
||||
- Example 3: JSON with Back Translation and Change Log
|
||||
- Input:
|
||||
- target_language: “French (France)”
|
||||
- domain: “UX copy”
|
||||
- include_back_translation: true
|
||||
- include_change_log: true
|
||||
- output_wrapper: “json”
|
||||
- text: “Tap Continue to save your changes.”
|
||||
- Output (json):
|
||||
{
|
||||
"translation": "Touchez Continuer pour enregistrer vos modifications.",
|
||||
"detected_source_language": "English",
|
||||
"formality": "neutral",
|
||||
"dialect": "fr-FR",
|
||||
"domain": "UX copy",
|
||||
"glossary_applied": [],
|
||||
"change_log": [
|
||||
"Chose 'Touchez' for mobile UI context over 'Appuyez sur'.",
|
||||
"Used 'Continuer' to match common button label."
|
||||
],
|
||||
"back_translation": "Touch Continue to save your changes."
|
||||
}
|
||||
|
||||
### Implementation Notes
|
||||
|
||||
- Detection: Lightweight detection; only announce if confidence > 0.7.
|
||||
- Sentence splitting: Keep sentence boundaries; avoid merging unless required by the target language.
|
||||
- Typography: Apply target-language quotes and dashes if not constrained by keep_formatting.
|
||||
- QA: If include_back_translation, ensure it’s a literal back-translation, not a rephrase.
|
||||
- Performance: Avoid unnecessary explanations; follow output_wrapper strictly.
|
||||
49
plugin.lock.json
Normal file
49
plugin.lock.json
Normal file
@@ -0,0 +1,49 @@
|
||||
{
|
||||
"$schema": "internal://schemas/plugin.lock.v1.json",
|
||||
"pluginId": "gh:samuelgarrett/claude-code-plugin-test:my-first-plugin",
|
||||
"normalized": {
|
||||
"repo": null,
|
||||
"ref": "refs/tags/v20251128.0",
|
||||
"commit": "5097d1a94fd434346e374aa409e55e41452d1877",
|
||||
"treeHash": "51750567872feb4e565809fc3c4c23dbfbc045848b997ef2291b0d8c4a6870c7",
|
||||
"generatedAt": "2025-11-28T10:28:08.439939Z",
|
||||
"toolVersion": "publish_plugins.py@0.2.0"
|
||||
},
|
||||
"origin": {
|
||||
"remote": "git@github.com:zhongweili/42plugin-data.git",
|
||||
"branch": "master",
|
||||
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
|
||||
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
|
||||
},
|
||||
"manifest": {
|
||||
"name": "my-first-plugin",
|
||||
"description": "A simple greeting plugin to learn the basics. Also a translator plugin",
|
||||
"version": "2.0.0"
|
||||
},
|
||||
"content": {
|
||||
"files": [
|
||||
{
|
||||
"path": "README.md",
|
||||
"sha256": "43d90462603afeb49678d8a56b3c11b9b5010929dddadbdde5178ec7f97cc2e3"
|
||||
},
|
||||
{
|
||||
"path": ".claude-plugin/plugin.json",
|
||||
"sha256": "e7645d1564e902ade814759985d55d878c1e6edf8fb72554480dd6d40240b746"
|
||||
},
|
||||
{
|
||||
"path": "commands/translator.md",
|
||||
"sha256": "d7c44bc917a410b079859404c4efd4f3d548b9b75ae7384dbd5a52f81ecef12b"
|
||||
},
|
||||
{
|
||||
"path": "commands/hello.md",
|
||||
"sha256": "ec61457749b6e8d98aee7a62cf5adf17889c8ae78eddd521e5135800a2764e38"
|
||||
}
|
||||
],
|
||||
"dirSha256": "51750567872feb4e565809fc3c4c23dbfbc045848b997ef2291b0d8c4a6870c7"
|
||||
},
|
||||
"security": {
|
||||
"scannedAt": null,
|
||||
"scannerVersion": null,
|
||||
"flags": []
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user