Skip to content

Language Support

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

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.

Supported Languages

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

Language Code Mapping

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 Interface

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.

CLI Flag

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

wikigen -lang en myproject owner/repo

Environment Variable

The WIKI_LANGUAGE environment variable provides an alternative method for setting the default language:

export WIKI_LANGUAGE=fr
wikigen myproject owner/repo

Configuration Precedence

The language selection follows this precedence order:

  1. CLI flag -lang (highest priority)
  2. Environment variable WIKI_LANGUAGE
  3. Default value ja (Japanese) (lowest priority)

Sources: tomohiro-owada_wikigen/main.go:908

Language Impact on Prompt Generation

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.

Structure Determination Phase

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

Page Content Generation Phase

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:

  1. In the "Output Language" section (line 300): "Write ALL content in [LANGUAGE_NAME]."
  2. 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

Language Flow Through Generation Pipeline

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
Loading

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

Language Consistency

Once a language is selected for a wiki generation session, the same language is maintained across all operations:

  1. Structure Determination: All page planning and architectural analysis occurs in the specified language
  2. Page Generation: All individual wiki pages are generated in the specified language
  3. Retry Operations: If pages fail and are retried via the -retry flag, they are regenerated in the same language
  4. 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

Language Selection Examples

Generating English Documentation

wikigen -lang en -r owner/repo my-wiki

This generates wiki pages with all content, headings, descriptions, and explanations in English.

Generating French Documentation

export WIKI_LANGUAGE=fr
wikigen -r owner/repo my-wiki

This generates wiki pages with all content in French (Français).

Generating Traditional Chinese Documentation

wikigen -lang zh-tw -r owner/repo my-wiki

This generates wiki pages with all content in Traditional Chinese (繁體中文).

Language-Aware Content Generation

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 for pt-br)

Sources: tomohiro-owada_wikigen/main.go:356-360

Related Pages

Clone this wiki locally