-
Notifications
You must be signed in to change notification settings - Fork 1
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.
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
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
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 PortugueseSource: wikigen/main.go:910
The WIKI_LANGUAGE environment variable can be set in .env or as a system environment variable:
export WIKI_LANGUAGE=en
./wikigen owner/repoAlternatively, 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 selection affects two critical stages of wiki generation:
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
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
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"]
The language parameter flows through the entire generation pipeline:
- User specifies language via CLI flag or environment variable
- Language code is mapped to human-readable language name
- Language name is passed to structure determination prompt
- Claude determines wiki structure (page titles and descriptions) in the target language
- Language name is passed to each page generation prompt
- Claude generates all page content in the target language
- Final wiki output is delivered entirely in the specified language
Source: wikigen/main.go:474, 529, 594
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
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/repoThe -lang flag integrates seamlessly with other workflow parameters such as model selection and parallelism settings.
Source: README.md:258-261
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 5All pages in the resulting wiki, including cross-repository architecture and integration documentation, are generated in the specified language.
Source: README.md:373-386
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 codesSource: wikigen/main.go:364-376
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
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
- CLI Usage & Commands — Complete command reference including all flags and language specification examples
- Configuration & Environment Variables — Detailed reference for WIKI_LANGUAGE environment variable and configuration precedence
- Claude Code Integration — How language specifications are passed to Claude CLI prompts
- Documentation Generation Policy — Content generation guidelines applied across all languages
- GitHub Actions Integration — Automated wiki generation with language configuration in workflows
- System Overview
- Architecture & Design
- CLI Usage & Commands
- Configuration & Environment
- Input Formats & Repository Configuration
- Authentication & Git Integration
- Output Format & Wiki Structure
- Error Handling & Retry Mechanism
- Parallel Processing & Performance
- Input Validation & Security
- Build & Deployment
- Claude Code Integration
- Wiki Generation Processing Flow
- Multi-Repository Wiki Support
- Progress Tracking & Output Modes