Traduction de fichiers JSON i18n

VérifiéPrudence

Traduit des fichiers JSON i18n en plusieurs langues avec optimisation de qualité par IA.

Spar Skills Guide Bot
DeveloppementIntermédiaire
23/07/2026
Claude CodeCursorWindsurfCodex
#i18n#translation#localization#cli#json

Recommandé pour

Synthèse automatique

Installe et pilote l'outil en ligne de commande jta pour traduire des fichiers JSON d'internationalisation vers plusieurs langues via un fournisseur d'IA.

Points forts

  • Détecte automatiquement la clé API disponible (Anthropic, Gemini, OpenAI) et transmet le bon flag --provider
  • Mécanisme de réflexion de l'agent qui évalue et améliore ses propres traductions
  • Protection des variables {x}, {{placeholders}}, balises HTML, URLs et Markdown
  • Mode incrémental pour ne retraduire que le contenu modifié et réduire les coûts, avec prise en charge de 27 langues dont RTL

Limites

  • Dépend d'un binaire tiers installé depuis GitHub (Homebrew ou téléchargement direct) et d'une clé API payante
  • Les instructions fournies s'arrêtent en pleine commande de mode incrémental, donc cette partie doit être complétée par l'utilisateur
  • La qualité des traductions dépend entièrement du modèle du fournisseur choisi
Quand l'utiliser

À utiliser lorsqu'un projet contient des fichiers de locale JSON et qu'il faut les traduire ou mettre à jour vers une ou plusieurs langues cibles.

Quand l'éviter

À éviter si vous ne pouvez pas installer de binaire externe ni exposer une clé API, ou si les chaînes à traduire ne sont pas stockées en JSON.

Analyse de sécurité

Prudence
Score qualité74/100

The skill is a wrapper around a third-party CLI. It does not contain destructive commands, obfuscated payloads, or secret exfiltration, but it does download an unverified remote binary and elevate it into the system PATH with sudo, plus a third-party brew tap. These are powerful, system-modifying actions for a legitimate purpose, so it warrants caution rather than outright risk.

Points d'attention
  • •Installs a remote binary downloaded via curl from GitHub releases with no checksum/signature verification, then chmod +x and `sudo mv` into /usr/local/bin — effectively trusting and elevating unverified remote code
  • •Adds a third-party Homebrew tap (hikanner/jta) and installs with sudo-level system changes without user confirmation step
  • •Reads arbitrary JSON files across the repo via broad `find` patterns and writes translations into the project, modifying user files
  • •Handles provider API keys (ANTHROPIC/OPENAI/GEMINI) in the environment and passes them to an external CLI; the skill itself does not exfiltrate them, but the third-party tool receives them
  • •`sudo` is invoked unconditionally in the install path, which can fail or prompt unexpectedly in agent environments
Comment cette analyse est faite

Exemples

Translate to Chinese
Translate my locales/en.json file to Chinese using jta
Add several languages
Add Japanese and Korean translations for the i18n JSON file in src/locales/
Update existing translations
Use incremental mode to update only the new strings in our locale files for German and French

name: jta description: Translate JSON i18n files to multiple languages with AI-powered quality optimization. Use when user mentions translating JSON, i18n files, internationalization, locale files, or needs to convert language files to other languages. version: 1.0.0 allowed-tools: Read, Write, Bash, Glob

Jta Translation

AI-powered JSON internationalization file translator with Agentic reflection mechanism.

When to Use This Skill

  • User asks to translate JSON i18n/locale files
  • User mentions "internationalization", "i18n", "l10n", or "locale"
  • User wants to add new languages to their project
  • User needs to update existing translations
  • User mentions specific languages like "translate to Chinese/Japanese/Korean"

Core Capabilities

  1. Agentic Translation: AI translates, evaluates, and improves its own work (3x API calls per batch)
  2. Smart Terminology: Automatically detects and maintains consistent terms (brand names, technical terms)
  3. Format Protection: Preserves {variables}, {{placeholders}}, HTML tags, URLs, Markdown
  4. Incremental Mode: Only translates new/changed content (saves 80-90% API cost on updates)
  5. 27 Languages: Including RTL languages (Arabic, Hebrew, Persian, Urdu)

Instructions

Step 1: Check if jta is installed

# Check if jta exists
if ! command -v jta &> /dev/null; then
  echo "jta not found, will install"
fi

Step 2: Install jta if needed

# Detect OS and install jta
OS="$(uname -s)"
ARCH="$(uname -m)"

if [[ "$OS" == "Darwin"* ]]; then
  # macOS - try Homebrew first
  if command -v brew &> /dev/null; then
    brew tap hikanner/jta
    brew install jta
  else
    # Download binary
    if [[ "$ARCH" == "arm64" ]]; then
      curl -L https://github.com/hikanner/jta/releases/latest/download/jta-darwin-arm64 -o jta
    else
      curl -L https://github.com/hikanner/jta/releases/latest/download/jta-darwin-amd64 -o jta
    fi
    chmod +x jta
    sudo mv jta /usr/local/bin/
  fi
elif [[ "$OS" == "Linux"* ]]; then
  # Linux
  curl -L https://github.com/hikanner/jta/releases/latest/download/jta-linux-amd64 -o jta
  chmod +x jta
  sudo mv jta /usr/local/bin/
fi

# Verify installation
jta --version

Step 3: Check for API key and set provider

Jta requires an AI provider API key. Check in this order and set the provider flag:

# Detect API key and set provider flag
if [[ -n "$ANTHROPIC_API_KEY" ]]; then
  echo "✓ Anthropic API key found"
  PROVIDER_FLAG="--provider anthropic"
elif [[ -n "$GEMINI_API_KEY" ]]; then
  echo "✓ Gemini API key found"
  PROVIDER_FLAG="--provider gemini"
elif [[ -n "$OPENAI_API_KEY" ]]; then
  echo "✓ OpenAI API key found"
  PROVIDER_FLAG=""  # OpenAI is default, no flag needed
else
  echo "✗ No API key found. Please set one of:"
  echo "  export OPENAI_API_KEY=sk-..."
  echo "  export ANTHROPIC_API_KEY=sk-ant-..."
  echo "  export GEMINI_API_KEY=..."
  exit 1
fi

Important: Save the PROVIDER_FLAG value to use in translation commands.

Step 4: Identify source file

# Find JSON files in common i18n/locale directories
find . -type f -name "*.json" \
  \( -path "*/locales/*" -o \
     -path "*/locale/*" -o \
     -path "*/i18n/*" -o \
     -path "*/lang/*" -o \
     -path "*/translations/*" \) \
  | head -20

Ask user to confirm which file to translate if multiple found.

Step 5: Determine translation requirements

Ask user (if not specified in their request):

  • Target languages (e.g., "zh,ja,ko")
  • Whether to use incremental mode (recommended for updates)
  • Output location preference

Step 6: Execute translation

Always use $PROVIDER_FLAG from Step 3 to ensure the correct AI provider is used:

# Basic translation with detected provider
jta <source-file> --to <target-langs> $PROVIDER_FLAG

# Examples:
# Single language
jta en.json --to zh $PROVIDER_FLAG

# Multiple languages
jta en.json --to zh,ja,ko $PROVIDER_FLAG

# Incremental mode (for updates)
jta en.json --to zh --incremental $PROVIDER_FLAG

# With custom output
jta en.json --to zh --output ./locales/zh.json $PROVIDER_FLAG

# Non-interactive mode (for multiple languages)
jta en.json --to zh,ja,ko,es,fr -y $PROVIDER_FLAG

# Override with specific model for quality
jta en.json --to zh --provider anthropic --model claude-sonnet-4-5

# Translate specific keys only
jta en.json --to zh --keys "settings.*,user.*" $PROVIDER_FLAG

# Exclude certain keys
jta en.json --to zh --exclude-keys "admin.*,internal.*" $PROVIDER_FLAG

Step 7: Verify results

After translation completes:

# Check output files exist
ls -lh <output-files>

# Validate JSON structure
for file in <output-files>; do
  if jq empty "$file" 2>/dev/null; then
    echo "✓ $file is valid JSON"
  else
    echo "✗ $file has invalid JSON"
  fi
done

Step 8: Report to user

Show the user:

  • Translation statistics (total items, success rate, API calls, duration)
  • Location of output files
  • Any errors or warnings
  • Cost implications if significant (e.g., "Used 15 API calls, estimated $0.30")

Terminology Management

Jta automatically creates a .jta/ directory to store terminology:

.jta/
├── terminology.json       # Source language terms (preserve + consistent)
├── terminology.zh.json    # Chinese translations
├── terminology.ja.json    # Japanese translations
└── terminology.ko.json    # Korean translations

terminology.json structure:

{
  "version": "1.0",
  "sourceLanguage": "en",
  "preserveTerms": ["API", "OAuth", "GitHub"],
  "consistentTerms": ["credits", "workspace", "prompt"]
}

Users can manually edit these files for custom terminology.

Common Patterns

Note: Always include $PROVIDER_FLAG (from Step 3) in your commands.

Pattern 1: First-time translation

# User: "Translate my en.json to Chinese and Japanese"
jta locales/en.json --to zh,ja -y $PROVIDER_FLAG

Pattern 2: Update existing translations

# User: "I added new keys to en.json, update the translations"
jta locales/en.json --to zh,ja --incremental -y $PROVIDER_FLAG

Pattern 3: Translate specific sections

# User: "Only translate the settings and user sections"
jta en.json --to zh --keys "settings.**,user.**" $PROVIDER_FLAG

Pattern 4: High-quality translation

# User: "Use the best model for highest quality"
jta en.json --to zh --provider anthropic --model claude-sonnet-4-5

Pattern 5: RTL languages

# User: "Translate to Arabic and Hebrew"
jta en.json --to ar,he -y $PROVIDER_FLAG
# Jta automatically handles bidirectional text markers

Error Handling

Error: "jta: command not found"

  • Run the installation script from Step 2
  • Verify with jta --version

Error: "API key not set"

Prompt user:

Jta requires an AI provider API key. Please set one of:

For OpenAI (recommended):
  export OPENAI_API_KEY=sk-...
  Get key at: https://platform.openai.com/api-keys

For Anthropic:
  export ANTHROPIC_API_KEY=sk-ant-...
  Get key at: https://console.anthropic.com/

For Google Gemini:
  export GEMINI_API_KEY=...
  Get key at: https://aistudio.google.com/app/apikey

Error: "Rate limit exceeded"

# Reduce batch size and concurrency
jta en.json --to zh --batch-size 10 --concurrency 1

Error: "Invalid JSON"

# Validate source file
jq . source.json

Error: Translation quality issues

  1. Try a better model:

    jta en.json --to zh --provider anthropic --model claude-sonnet-4-5
    
  2. Check terminology files in .jta/ and edit if needed

  3. Use verbose mode to debug:

    jta en.json --to zh --verbose
    

Performance Tips

  • Small files (<100 keys): Use default settings
  • Large files (>500 keys): Use --batch-size 10 --concurrency 2
  • Frequent updates: Always use --incremental to save cost
  • Quality priority: Use --provider anthropic --model claude-sonnet-4-5
  • Speed priority: Use --provider openai --model gpt-3.5-turbo (if available)
  • Cost priority: Use incremental mode + larger batch sizes

Supported Languages

27 languages with full support:

Left-to-Right (LTR):

  • European: en, es, fr, de, it, pt, ru, nl, pl, tr
  • Asian: zh, zh-TW, ja, ko, th, vi, id, ms, hi, bn, si, ne, my

Right-to-Left (RTL):

  • Middle Eastern: ar, fa, he, ur

View all supported languages:

jta --list-languages

Output Format

Jta produces:

  1. Translated JSON files: Same structure as source, with translations
  2. Statistics: Printed to console
  3. Terminology files: In .jta/ directory for consistency

Always inform the user of:

  • Number of items translated
  • Success/failure count
  • Output file locations
  • Any errors or warnings
  • API usage and estimated cost (if significant)

Advanced Options

Note: Remember to include $PROVIDER_FLAG in your commands.

# Skip terminology detection (use existing)
jta en.json --to zh --skip-terminology $PROVIDER_FLAG

# Disable terminology management completely
jta en.json --to zh --no-terminology $PROVIDER_FLAG

# Re-detect terminology (when source language changes)
jta en.json --to zh --redetect-terms $PROVIDER_FLAG

# Custom terminology directory (for shared terms)
jta en.json --to zh --terminology-dir ../shared-terms/ $PROVIDER_FLAG

# Specify source language explicitly
jta myfile.json --source-lang en --to zh $PROVIDER_FLAG

# Custom batch size and concurrency
jta en.json --to zh --batch-size 20 --concurrency 3 $PROVIDER_FLAG

# Verbose output for debugging
jta en.json --to zh --verbose $PROVIDER_FLAG

Examples

See examples/ directory for detailed, step-by-step use cases.

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/json-i18n-file-translation-mrx3xy4o' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/json-i18n-file-translation-mrx3xy4o/download' --output '.skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md.part' && mv '.skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md.part' '.skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Outils déclarés par l’auteur (à vérifier dans votre agent) : Read, Write, Bash, Glob

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md' && test -s '.skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/jta' && cp -R '.skill-downloads/json-i18n-file-translation-mrx3xy4o' '.claude/skills/jta'

Cursor
test -f '.skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md' && test -s '.skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/jta' && cp -R '.skill-downloads/json-i18n-file-translation-mrx3xy4o' '.cursor/skills/jta'

Codex
test -f '.skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md' && test -s '.skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/jta' && cp -R '.skill-downloads/json-i18n-file-translation-mrx3xy4o' '.agents/skills/jta'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/json-i18n-file-translation-mrx3xy4o'

openskills read 'json-i18n-file-translation-mrx3xy4o'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/json-i18n-file-translation-mrx3xy4o/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires