Translation Guide
This guide explains how to contribute translations for FastAPI-fastkit documentation.
Source of truth and translation policy
English (
en) is the canonical source of truth for FastAPI-fastkit documentation. Every other locale is a translation target that may lag behind English by a release or by individual pages.If a translated page disagrees with the English page, trust the English page until the translation catches up. Translations are shipped at whatever completeness contributors have reached — partial coverage is normal and expected.
The user-facing companion to this policy is the Translation Status page, which lists each locale's actual completeness and how MkDocs renders pages that haven't been translated yet (TL;DR: they fall back to English).
The repository-root CHANGELOG.md also remains in English as the
canonical release history. If a locale exposes a changelog.md page,
that page should link to or include the canonical English changelog
rather than maintain a separate translated changelog unless project
policy changes later.
When you contribute a translation, also update the status page's table so users can tell what's available without guessing from the language switcher.
Overview
FastAPI-fastkit uses an automated translation system powered by AI to translate documentation into multiple languages. The system:
- Reads source documentation in English
- Translates content using AI APIs (OpenAI or Anthropic)
- Saves translations to language-specific directories
- Creates GitHub Pull Requests for review
The automation produces a starting point; human review is still required before merging. AI-generated translations should be flagged as "draft" in their PRs and reviewed by a fluent speaker before landing.
Supported Languages
These are the locales the docs site currently builds. Build target configuration alone does not mean a locale's pages are translated — see Translation Status for actual per-locale completeness.
- 🇰🇷 Korean (ko)
- 🇯🇵 Japanese (ja)
- 🇨🇳 Chinese (zh)
- 🇪🇸 Spanish (es)
- 🇫🇷 French (fr)
- 🇩🇪 German (de)
Prerequisites
1. Install Translation Dependencies
2. Set Up API Keys
You need an API key from either OpenAI or Anthropic:
# For OpenAI
export TRANSLATION_API_KEY="sk-..."
# Or for Anthropic
export TRANSLATION_API_KEY="sk-ant-..."
3. Install GitHub CLI (Optional)
For automatic PR creation:
# macOS
brew install gh
# Linux
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
# Authenticate
gh auth login
Usage
Using Make Commands (Recommended)
The easiest way to run translations:
# Translate all docs to all languages
make translate
# Translate to specific language
make translate LANG=ko
# Specify API provider and model
make translate LANG=ko PROVIDER=openai MODEL=gpt-4
make translate LANG=ko PROVIDER=github MODEL=gpt-4o-mini
Using Script Directly
Translate All Documentation
Translate all documentation to all supported languages:
Translate to Specific Language
Translate only to Korean:
Translate Specific Files
Translate only specific documentation files:
python scripts/translate.py \
--target-lang ko \
--files user-guide/installation.md user-guide/quick-start.md \
--api-provider openai
Skip PR Creation
Translate without creating a GitHub PR:
Use Anthropic Claude
Use Anthropic's Claude instead of OpenAI:
Directory Structure
After translation, the documentation structure will look like this:
docs/
├── en/ # English (original)
│ ├── index.md
│ ├── user-guide/
│ │ ├── installation.md
│ │ ├── quick-start.md
│ │ └── ...
│ ├── tutorial/
│ └── ...
├── ko/ # Korean
│ ├── index.md
│ ├── user-guide/
│ └── ...
├── ja/ # Japanese
├── zh/ # Chinese
├── es/ # Spanish
├── fr/ # French
├── de/ # German
├── css/ # Shared assets
├── js/ # Shared assets
└── img/ # Shared assets
Translation Workflow
1. Write Documentation in English
All documentation should first be written in English in the docs/ directory:
2. Run Translation
Once the English documentation is complete, run the translation script:
3. Review Pull Request
The script will create a Pull Request with the translations. Review the PR:
- Check that markdown formatting is preserved
- Verify technical terms are handled correctly
- Ensure code examples remain unchanged
- Check for language-specific issues
Changelog policy
- Keep the repository-root
CHANGELOG.mdin English. - Do not open translation PRs whose goal is to rewrite release history into another language inside the root changelog.
- If a locale needs a changelog page, treat
docs/<locale>/changelog.mdas a wrapper or entry point for the canonical English changelog.
4. Approve and Merge (for maintainers)
Once the translation is verified:
5. Deploy Documentation
The documentation site will automatically rebuild with the new translations.
Translation Configuration
Edit scripts/translation_config.json to customize:
{
"source_language": "en",
"target_languages": [
{
"code": "ko",
"name": "Korean",
"native_name": "한국어",
"enabled": true
}
],
"translation_settings": {
"default_api_provider": "openai",
"batch_size": 5,
"preserve_formatting": true
},
"github_settings": {
"create_pr_by_default": true,
"branch_prefix": "translation"
}
}
Best Practices
For Source Documentation
- Use Clear Language: Write clear, simple English that translates well
- Consistent Terminology: Use consistent technical terms
- Proper Code Blocks: Always specify language in code blocks
- Link Verification: Ensure all internal links use relative paths
For Translation Review
- Technical Terms: Verify technical terms are appropriate for target language
- Cultural Context: Check if examples need localization
- Formatting: Ensure all markdown formatting is preserved
- Code Integrity: Verify code blocks are unchanged
Troubleshooting
API Rate Limits
If you hit API rate limits, translate in smaller batches:
# Translate only user guide
python scripts/translate.py \
--target-lang ko \
--files user-guide/*.md
Translation Quality Issues
If translations are poor quality:
- Check your API key is valid
- Try a different AI provider
- Break down complex documents into smaller sections
- Manually review and edit the translation
GitHub PR Fails
If PR creation fails:
# Translate without PR
python scripts/translate.py --target-lang ko --no-pr
# Manually create PR
git checkout -b translation/ko
git add docs/ko/
git commit -m "Add Korean translations"
git push -u origin translation/ko
gh pr create --title "Add Korean translations"
Manual Translation
You can also translate manually:
-
Copy English file to target language directory:
-
Edit the file in your preferred editor
- Commit and create a PR
Language Switching
The documentation site includes a language switcher in the top navigation. Users can:
- Click the language selector
- Choose their preferred language
- Navigate through translated documentation
Contributing New Languages
To add a new language:
-
Edit
scripts/translation_config.json: -
Update
mkdocs.yml: -
Run translation:
Need Help?
- Issues: Report translation issues on GitHub Issues
- Discussions: Ask questions in GitHub Discussions
- Contributing: See CONTRIBUTING.md
Translation Quality Standards
All translations must meet these standards:
- ✅ Preserve all markdown formatting
- ✅ Keep code blocks unchanged
- ✅ Maintain technical terminology appropriately
- ✅ Use proper grammar and spelling
- ✅ Follow language-specific conventions
- ✅ Test all links work correctly
Thank you for contributing to FastAPI-fastkit translations! 🌍