How to Use the `--language` Flag for Multilingual Output Generation in Understand Anything

The --language flag instructs the Understand Anything engine to generate all textual artifacts—including summaries, descriptions, tags, titles, languageNotes, and languageLesson fields—in a specified target language by persisting the preference to .understand-anything/config.json and injecting locale-specific guidance into every LLM prompt.

The Egonex-AI/Understand-Anything repository provides a code analysis engine that supports multilingual documentation pipelines through a simple command-line interface. By leveraging the --language flag during execution of the /understand skill, developers can override the default English output and produce comprehensive knowledge graphs in ISO-639-1 compliant languages. This capability ensures that global teams can consume generated documentation natively without post-processing translation.

Syntax and Supported Language Formats

The flag accepts both standardized codes and human-readable identifiers.

  • ISO-639-1 codes: Two-letter identifiers such as zh, ja, ko, es, fr, de, and en.
  • Friendly names: Full language names like chinese, japanese, korean, spanish, or english.
  • Locale variants: Regional specificities including zh-TW (Traditional Chinese) or zh-HK (Hong Kong Chinese) for nuanced localization.

When provided, the skill extracts the language argument from $ARGUMENTS and normalizes it to a standard code before storage.

Pipeline Integration and Output Control

The --language flag influences four distinct stages of the generation pipeline:

Configuration Persistence

Upon detecting --language <lang>, the skill writes the normalized code to .understand-anything/config.json under the key outputLanguage. Subsequent runs—including incremental updates via --auto-update—automatically reuse this setting, ensuring consistency across the entire knowledge-graph generation lifecycle.

Prompt Engineering with Locale Guidance

The system injects a locale-specific guidance snippet located at skills/understand/locales/<code>.md immediately after the language/framework context in the prompt. For example, when targeting Japanese, the engine appends locales/ja.md, which contains style rules for tag formatting, summary tone, and naming conventions specific to Japanese technical documentation.

LLM Directive Injection

All prompts dispatched to the language model include an explicit directive such as "Generate all textual content in Japanese while preserving technical terms in English when no native equivalent exists." This instruction ensures that conceptual explanations are localized while code identifiers remain unaltered for accuracy.

Artifact Generation

The resulting knowledge-graph.json populates node fields—including title, description, tags, and educational content like languageLesson—with text generated in the target language. File enumeration in Phase 1 continues to detect programming languages by extension, but the "Languages" narrative section reflects the output locale setting.

Fallback Behavior and Auto-Detection

When the --language flag is omitted, the skill initiates an automatic detection routine that infers the user's preferred language from the conversation context. If detection yields a non-English language, the system prompts the user once for confirmation before switching; otherwise, it silently defaults to English (en). This fallback mechanism ensures that explicit flag usage always takes precedence over heuristic detection.

Practical Usage Examples

Execute a full analysis with Spanish output:

understand --full --language es

Run an incremental update while preserving a previously configured French setting:

understand --auto-update

Generate documentation in Traditional Chinese for a single run without persisting the configuration:

understand --full --language zh-TW

Programmatic invocation from a Node.js script:

import { execSync } from 'child_process';

// Generate Korean documentation
execSync('understand --full --language ko', { stdio: 'inherit' });

Key Implementation Files

The multilingual capability is implemented across the following source locations:

Summary

  • The --language flag accepts ISO-639-1 codes, friendly names, and locale variants (e.g., zh-TW) to control output localization.
  • The setting persists in .understand-anything/config.json as outputLanguage and applies to all subsequent runs unless overridden.
  • Locale-specific guidance files (locales/<code>.md) are injected into prompts to ensure culturally appropriate technical writing.
  • Auto-detection fallback only activates when the flag is absent, defaulting to English if no preference is inferred.
  • All generated artifacts—including node titles, descriptions, and educational fields—are populated in the target language while preserving code identifiers.

Frequently Asked Questions

What happens if I specify an unsupported language code?

The skill attempts to normalize the input against known ISO-639-1 mappings and friendly names. If normalization fails, the system defaults to English (en) and logs a warning, ensuring the pipeline continues without breaking.

Does the --language flag translate existing English content or regenerate it?

The flag triggers regeneration rather than translation. The LLM re-analyzes the source code and produces original content in the target language, resulting in natural-sounding technical descriptions rather than literal translations of existing English text.

How do I permanently set a language preference for all future runs?

Execute any command with the --language flag once. The skill automatically writes the value to .understand-anything/config.json, and all future invocations—including --auto-update—will use this stored preference until the configuration file is manually edited or the flag is explicitly changed.

Are technical terms like function names and class identifiers also translated?

No. The locale guidance specifically instructs the LLM to preserve technical identifiers (function names, class names, file paths) in their original form. Only descriptive content such as summaries, tags, and educational explanations are localized to the target language.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →