home / skills / aidotnet / moyucode / text-translator

text-translator skill

/skills/tools/text-translator

This skill translates text across languages using free services, with auto-detect, batch processing, and file translation for efficient localization.

npx playbooks add skill aidotnet/moyucode --skill text-translator

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1021 B
---
name: text-translator
description: 使用免费翻译API在语言之间翻译文本,支持批量处理和文件翻译。
metadata:
  short-description: 翻译文本
source:
  repository: https://github.com/ssut/py-googletrans
  license: MIT
---

# Text Translator Tool

## Description
Translate text between languages using free translation services with support for auto-detection, batch processing, and file translation.

## Trigger
- `/translate` command
- User needs text translation
- User wants to localize content

## Usage

```bash
# Translate text
python scripts/text_translator.py "Hello world" --to zh

# Auto-detect source language
python scripts/text_translator.py "Bonjour" --to en

# Translate file
python scripts/text_translator.py --file document.txt --to es --output document_es.txt

# Batch translate
python scripts/text_translator.py --file strings.json --to ja --format json
```

## Tags
`translate`, `language`, `i18n`, `localization`, `text`

## Compatibility
- Codex: ✅
- Claude Code: ✅

Overview

This skill provides a Text Translator that uses free translation APIs to convert text between languages. It supports automatic source-language detection, batch translations, and translating files. The tool is implemented in TypeScript and designed for quick localization and ad-hoc translation tasks.

How this skill works

The translator sends text to free translation services and returns the translated output, optionally auto-detecting the source language. It accepts single strings, batches (arrays or files), and preserves file formats when exporting translated documents. Command-like usage supports specifying target language, output paths, and format options for structured files.

When to use it

  • Translate short snippets or sentences quickly between languages
  • Localize UI strings or configuration files using batch translation
  • Auto-detect the source language when the input language is unknown
  • Translate whole text files and save translated copies
  • Pre-process content for multilingual testing or review

Best practices

  • Validate and clean source text before sending to the API (remove markup you don’t want translated)
  • Use batch mode for consistent translations across multiple keys or strings
  • Specify target language using standard ISO codes (e.g., en, es, ja) to avoid ambiguity
  • Review and post-edit machine translations for tone, context, and domain-specific terms
  • Preserve formatting by translating only text regions in structured files (JSON, CSV)

Example use cases

  • Quickly translate UI string files (JSON) into multiple target languages for localization
  • Auto-detect language of user-submitted content and translate it for moderation or support
  • Translate a README or documentation file to produce localized copies
  • Batch-process a list of marketing copy for review in a target language
  • Translate chat messages or short customer replies on the fly

FAQ

Does the translator support file output and format preservation?

Yes. You can translate files and save the translated output while keeping structure (for supported formats) when you specify an output path.

Can it detect the language automatically?

Yes. The tool supports auto-detection of the source language so you only need to provide the target language.