-
Notifications
You must be signed in to change notification settings - Fork 1
Language Support
wikigen supports multi-language documentation output, enabling wiki generation in ten distinct languages. The language selection directly influences prompt generation and output content, ensuring that generated documentation reflects the specified target language throughout the wiki generation pipeline.
wikigen provides comprehensive language support covering major global languages. The following table documents all supported language codes, their full language names, and native language endonyms:
| Language Code | Language Name | Native Name |
|---|---|---|
en |
English | English |
ja |
Japanese | 日本語 |
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). Sources: tomohiro-owada_wikigen/main.go:364-376
wikigen maintains a language code-to-language name mapping via the languageName() function. This function accepts a language code as input and returns the full language name with native endonym in parentheses. Unknown language codes default to English.
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"
}Sources: tomohiro-owada_wikigen/main.go:364-376
Language selection is exposed via the CLI through the -lang flag, which accepts any of the supported language codes. The default language is Japanese. Language selection can also be configured through the WIKI_LANGUAGE environment variable, with CLI flags taking precedence.
The -lang flag specifies the output language for the wiki:
wikigen -lang en myproject owner/repo
The WIKI_LANGUAGE environment variable provides an alternative method for setting the default language:
export WIKI_LANGUAGE=fr
wikigen myproject owner/repoThe language selection follows this precedence order:
- CLI flag
-lang(highest priority) - Environment variable
WIKI_LANGUAGE - Default value
ja(Japanese) (lowest priority)
Sources: tomohiro-owada_wikigen/main.go:908
Language selection affects both phases of wiki generation: structure determination and page content generation. The language name is embedded into the system prompts as explicit instructions to Claude, ensuring that all generated documentation adheres to the specified language.
During structure determination, the language name is injected into the structure prompt at the critical instruction point. The prompt explicitly states: "IMPORTANT: All content will be written in [LANGUAGE_NAME]." This ensures that the architectural analysis and page planning occurs with language-specific considerations.
func structurePrompt(projectName string, repos []string, language string) string {
langName := languageName(language)
repoList := strings.Join(repos, ", ")
return fmt.Sprintf(`You are an expert software architect and technical writer.
...
IMPORTANT: All content will be written in %s.
...
`, projectName, repoList, langName)
}Sources: tomohiro-owada_wikigen/main.go:183-272
When generating individual wiki pages, the language name is similarly embedded in the page generation prompt. The language specification appears at two critical points in the prompt:
- In the "Output Language" section (line 300): "Write ALL content in [LANGUAGE_NAME]."
- In the "Writing Style" section (line 358): "Write in standard, professional [LANGUAGE_NAME]."
func pagePrompt(page WikiPage, allPages []WikiPage, projectName string, repos []string, language string) string {
langName := languageName(language)
...
return fmt.Sprintf(`You are an expert technical writer creating a wiki page.
...
## Output Language
Write ALL content in %s.
...
## Writing Style
...
- Write in standard, professional %s
...
`, projectName, repoList, page.Title, page.Description, langName, pageList.String(), page.Filename, page.Title, langName)
}Sources: tomohiro-owada_wikigen/main.go:275-362
The language parameter flows through the entire wiki generation pipeline, from initial CLI input through to page generation and retry operations:
flowchart TD
A["CLI Input<br/>-lang flag or<br/>WIKI_LANGUAGE env"]
B["Language Code<br/>Validation"]
C["languageName<br/>Function<br/>Code → Full Name"]
D["Structure<br/>Determination<br/>Prompt"]
E["Page Generation<br/>Prompt"]
F["Claude<br/>Execution<br/>With Language<br/>Instruction"]
G["Wiki Output<br/>In Target<br/>Language"]
H["Retry<br/>Mechanism<br/>Same Language"]
A --> B
B --> C
C --> D
C --> E
D --> F
E --> F
F --> G
F --> H
H --> G
The language code is preserved throughout the entire workflow:
- During structure determination (line 527), the language is passed to
structurePrompt() - During page generation (line 592), the language is passed to
pagePrompt() - During retry operations (line 859), the language is passed to maintain consistency
Sources: tomohiro-owada_wikigen/main.go:474-636, tomohiro-owada_wikigen/main.go:741-875
Once a language is selected for a wiki generation session, the same language is maintained across all operations:
- Structure Determination: All page planning and architectural analysis occurs in the specified language
- Page Generation: All individual wiki pages are generated in the specified language
-
Retry Operations: If pages fail and are retried via the
-retryflag, they are regenerated in the same language - Home and Sidebar: Navigation pages (Home.md and _Sidebar.md) are generated with content descriptions in the specified language
This consistency ensures that generated wikis maintain linguistic uniformity regardless of repository complexity or page count.
Sources: tomohiro-owada_wikigen/main.go:1032, tomohiro-owada_wikigen/main.go:941
wikigen -lang en -r owner/repo my-wikiThis generates wiki pages with all content, headings, descriptions, and explanations in English.
export WIKI_LANGUAGE=fr
wikigen -r owner/repo my-wikiThis generates wiki pages with all content in French (Français).
wikigen -lang zh-tw -r owner/repo my-wikiThis generates wiki pages with all content in Traditional Chinese (繁體中文).
The language selection influences not only the output language but also the tone and style guidance provided to Claude. The writing style guidelines remain language-neutral (formal, technical documentation standards), but are applied within the context of the specified language:
- Technical Language: Documentation maintains professional, formal technical language standards in the target language
- No Dialect Variation: The prompts explicitly instruct against casual expressions or colloquialisms in any language
-
Standard Forms: For languages with multiple written or spoken variants (e.g., Chinese, Portuguese), the specific variant is selected (Traditional Chinese for
zh-tw, Brazilian Portuguese forpt-br)
Sources: tomohiro-owada_wikigen/main.go:356-360
- System Overview — Introduction to wikigen, its purpose, and architecture approach
- CLI Interface & Flags — Complete command-line interface specification including all flags
- Configuration & Environment — Configuration system including environment variable support
- Claude Code Integration — How wikigen leverages Claude Code with language-aware prompts
- Wiki Generation Pipeline — Complete wiki generation process including language-aware prompt generation
- 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