Skip to content

Language Support Localization

github-actions[bot] edited this page Mar 14, 2026 · 1 revision

Language Support & Localization

wikigen supports multi-language output for generated wiki documentation. Users can specify their desired output language via the -lang command-line flag or the WIKI_LANGUAGE environment variable, enabling documentation generation in ten languages while maintaining consistent structure and formatting across all output.

Supported Languages

wikigen supports ten languages for wiki generation:

Language Code Language Name Native Name
ja Japanese 日本語
en English English
zh Mandarin Chinese 中文
zh-tw Traditional Chinese 繁體中文
es Spanish Español
kr Korean 한국어
vi Vietnamese Tiếng Việt
pt-br Brazilian Portuguese Português Brasileiro
fr French Français
ru Russian Русский

The default language is Japanese (ja). If an unsupported language code is provided, the system defaults to English.

Source: wikigen/main.go:364-376

Language Name Mapping

wikigen maintains a language mapping function that translates language codes to full language names, including native language names. This mapping is embedded in the application and used during wiki generation to inform Claude Code of the target output language.

func languageName(code string) string {
	names := map[string]string{
		"ja": "Japanese (日本語)", "en": "English", "zh": "Mandarin Chinese (中文)",
		"zh-tw": "Traditional Chinese (繁體中文)", "es": "Spanish (Español)",
		"kr": "Korean (한국어)", "vi": "Vietnamese (Tiếng Việt)",
		"pt-br": "Brazilian Portuguese (Português Brasileiro)",
		"fr": "Français (French)", "ru": "Русский (Russian)",
	}
	if n, ok := names[code]; ok {
		return n
	}
	return "English"
}

The function performs a simple map lookup and returns the English and native name. If the provided code is not found, the function defaults to "English". This ensures that invalid language codes do not cause generation failures.

Source: wikigen/main.go:364-376

Language Configuration

Command-Line Flag

The -lang flag specifies the output language for wiki generation:

./wikigen -lang ja owner/repo        # Japanese (default)
./wikigen -lang en owner/repo        # English
./wikigen -lang zh owner/repo        # Mandarin Chinese
./wikigen -lang pt-br owner/repo     # Brazilian Portuguese

Source: wikigen/main.go:910

Environment Variable

The WIKI_LANGUAGE environment variable can be set in .env or as a system environment variable:

export WIKI_LANGUAGE=en
./wikigen owner/repo

Alternatively, in .env:

WIKI_LANGUAGE=en

CLI flags take precedence over environment variables. If neither is specified, the default language is Japanese (ja).

Source: wikigen/main.go:910

Language Integration in Documentation Generation

Language selection affects two critical stages of wiki generation:

Structure Determination Phase

During the structure determination phase, Claude Code receives the language specification in the system prompt. The language is used to instruct Claude which language to generate the wiki structure in.

func structurePrompt(projectName string, repos []string, language string) string {
	langName := languageName(language)
	// ...
	return fmt.Sprintf(`...
IMPORTANT: All content will be written in %s.
...`, projectName, repoList, langName)
}

This ensures that the page titles and descriptions in the XML structure response are generated in the specified language.

Source: wikigen/main.go:183-273

Page Content Generation Phase

During page generation, the language is passed to the page content prompt:

func pagePrompt(page WikiPage, allPages []WikiPage, projectName string, repos []string, language string) string {
	langName := languageName(language)
	// ...
	return fmt.Sprintf(`...
## Output Language
Write ALL content in %s.
...
## Writing Style
- Use formal, neutral technical language — NO dialects, slang, or personality quirks
- Write in standard, professional %s
...`, projectName, repoList, page.Title, page.Description, langName, pageList.String(), page.Filename, page.Title, langName)
}

This instructs Claude to generate all wiki page content in the specified language, maintaining the same formal and neutral technical writing style across all languages.

Source: wikigen/main.go:275-362

Language Flow in Wiki Generation Pipeline

flowchart TD
    A["User Specifies Language<br/>-lang flag or env var"] --> B["Language Code Mapping<br/>languageName function"]
    B --> C["Language Name<br/>e.g., 'English'"]
    C --> D["Structure Determination<br/>structurePrompt"]
    D --> E["Claude Determines<br/>Wiki Structure in<br/>Specified Language"]
    E --> F["Page Titles & Descriptions<br/>Generated in Target Language"]
    F --> G["Page Content Generation<br/>pagePrompt for each page"]
    G --> H["Claude Generates<br/>Page Content in<br/>Specified Language"]
    H --> I["Final Wiki Output<br/>All Content in<br/>Target Language"]
Loading

The language parameter flows through the entire generation pipeline:

  1. User specifies language via CLI flag or environment variable
  2. Language code is mapped to human-readable language name
  3. Language name is passed to structure determination prompt
  4. Claude determines wiki structure (page titles and descriptions) in the target language
  5. Language name is passed to each page generation prompt
  6. Claude generates all page content in the target language
  7. Final wiki output is delivered entirely in the specified language

Source: wikigen/main.go:474, 529, 594

Retry with Language Preservation

The -retry flag, which regenerates only failed pages, also respects the original language setting. When retrying failed pages, the language parameter is preserved and passed to the page generation prompt:

func retryFailedPages(claudePath, model, language, outputDir, cloneDir string, pageParallel int) {
	// ... locate failed pages ...
	_, err := claudeCall(claudePath, model, repoDirs, "", pagePrompt(wp, allPages, projectName, repos, language), projectDir)
	// ...
}

This ensures consistency: retried pages use the same language as the original generation.

Source: wikigen/main.go:743, 861

Language Specifications in GitHub Actions Workflow

When using the GitHub Actions workflow for automated wiki generation, the language can be specified in the workflow YAML:

- name: Generate wiki
  env:
    CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
  run: ./wikigen -lang en -pp 3 -model haiku -token "${{ secrets.GITHUB_TOKEN }}" owner/repo

The -lang flag integrates seamlessly with other workflow parameters such as model selection and parallelism settings.

Source: README.md:258-261

Language and Multi-Repository Wikis

Language selection applies uniformly to all repositories when generating multi-repository wikis. The language affects both repository-specific pages and cross-repository documentation:

# Multi-repo wiki in English
./wikigen -f repos.txt -lang en -p 2 -pp 5

All pages in the resulting wiki, including cross-repository architecture and integration documentation, are generated in the specified language.

Source: README.md:373-386

Implementation Details

Language Code Validation

Language codes are validated against the supported language map. If an unsupported code is provided, the system defaults to English rather than failing. This provides graceful degradation:

if n, ok := names[code]; ok {
	return n
}
return "English"  // Fallback for unknown codes

Source: wikigen/main.go:364-376

Prompt Integration

The language specification is embedded as explicit instructions in both the structure determination and page generation prompts. Claude receives clear directives to generate all content in the specified language using formal, neutral technical writing style.

Source: wikigen/main.go:199, 300, 357-360

Localization Scope

Language support covers:

  • Page titles and descriptions: Determined during structure analysis phase
  • Page content: All markdown body content including sections, explanations, code comments
  • Navigation elements: Page names in Home.md and _Sidebar.md
  • Error messages: Logged to _errors.log in the specified language

Language support does NOT affect:

  • Code snippets extracted from source files (these retain their original language)
  • File naming conventions (filenames remain English with hyphen-separated words)
  • Configuration and environment variable names (these remain unchanged)
  • Git commit messages in generated output

Related Pages

Clone this wiki locally