@@ -380,6 +380,207 @@ For more detailed information about security requirements and project guidelines
380380- [ SECURITY.md] ( SECURITY.md ) for security guidelines
381381- [ CODE_OF_CONDUCT.md] ( CODE_OF_CONDUCT.md ) for project principles
382382
383+ ## Contributing Translations
384+
385+ FastAPI-fastkit documentation supports multiple languages. Contributing translations helps users worldwide.
386+
387+ ### Supported Languages
388+
389+ - 🇬🇧 English (en) - Default
390+ - 🇰🇷 Korean (ko)
391+ - 🇯🇵 Japanese (ja)
392+ - 🇨🇳 Chinese (zh)
393+ - 🇪🇸 Spanish (es)
394+ - 🇫🇷 French (fr)
395+ - 🇩🇪 German (de)
396+
397+ ### Translation Setup
398+
399+ #### 1. Install Dependencies
400+
401+ ``` bash
402+ pdm install -G docs -G translation
403+ # Or: pip install mkdocs mkdocs-material mkdocs-static-i18n openai anthropic
404+ ```
405+
406+ #### 2. Set Up API Key
407+
408+ Get an API key from OpenAI or Anthropic and set it as an environment variable:
409+
410+ ``` bash
411+ export TRANSLATION_API_KEY=" your-api-key-here"
412+ ```
413+
414+ #### 3. First-Time Setup (Maintainers Only)
415+
416+ If this is the first time setting up the i18n structure:
417+
418+ ``` bash
419+ ./scripts/setup-i18n-structure.sh
420+ ```
421+
422+ This migrates existing English docs to ` docs/en/ ` and creates language directories.
423+
424+ ### Translating Documentation
425+
426+ #### Translate to Specific Language
427+
428+ ``` bash
429+ # Translate all docs to Korean
430+ python scripts/translate.py --target-lang ko --api-provider openai
431+
432+ # Translate specific files (paths relative to docs/en/)
433+ python scripts/translate.py --target-lang ko --files index.md user-guide/installation.md --api-provider openai
434+
435+ # Translate without creating PR (for local testing)
436+ python scripts/translate.py --target-lang ko --no-pr --api-provider openai
437+ ```
438+
439+ #### Using GitHub Actions
440+
441+ 1 . Go to repository → Actions → "Translate Documentation"
442+ 2 . Click "Run workflow"
443+ 3 . Select target language and options
444+ 4 . Wait for automated PR to be created
445+ 5 . Review and merge the translation
446+
447+ ### Translation Workflow
448+
449+ 1 . ** Write English documentation** in ` docs/en/ `
450+ 2 . ** Test locally** : ` mkdocs serve `
451+ 3 . ** Commit English version** to main branch
452+ 4 . ** Run translation script** or trigger GitHub Actions
453+ 5 . ** Review PR** : Check formatting, technical terms, links
454+ 6 . ** Merge** and deploy
455+
456+ ### Translation Quality Guidelines
457+
458+ When reviewing translations:
459+
460+ - ✅ Markdown formatting is preserved
461+ - ✅ Code blocks are unchanged
462+ - ✅ Technical terms are appropriate
463+ - ✅ Links work correctly
464+ - ✅ Grammar and spelling are correct
465+
466+ ### Manual Translation
467+
468+ You can also translate manually:
469+
470+ 1 . Copy file from ` docs/en/ ` to ` docs/{lang}/ `
471+ 2 . Translate the content
472+ 3 . Create PR with ` [DOCS] ` tag
473+
474+ ### Adding New Languages
475+
476+ To add support for a new language:
477+
478+ 1 . ** Update ` scripts/translation_config.json ` ** :
479+ ``` json
480+ {
481+ "code" : " pt" ,
482+ "name" : " Portuguese" ,
483+ "native_name" : " Português" ,
484+ "enabled" : true
485+ }
486+ ```
487+
488+ 2 . ** Update ` mkdocs.yml ` ** :
489+ ``` yaml
490+ - locale : pt
491+ name : Português
492+ build : true
493+ ` ` `
494+
495+ 3. **Run translation**:
496+ ` ` ` bash
497+ python scripts/translate.py --target-lang pt
498+ ```
499+
500+ ### Translation System Architecture
501+
502+ ** Core Components:**
503+
504+ - ** ` scripts/translate.py ` ** : AI-powered translation script
505+ - Supports OpenAI GPT-4 and Anthropic Claude
506+ - Preserves markdown formatting and code blocks
507+ - Creates GitHub PRs automatically
508+
509+ - ** ` scripts/setup-i18n-structure.sh ` ** : Migration tool
510+ - Moves docs to language-specific directories
511+ - Creates symbolic links for shared assets
512+
513+ - ** ` scripts/translation_config.json ` ** : Configuration
514+ - Language settings
515+ - Translation options
516+ - Quality check parameters
517+
518+ - ** ` .github/workflows/translate-docs.yml ` ** : GitHub Actions workflow
519+ - Automated translation on trigger
520+ - Manual workflow dispatch
521+
522+ ** Directory Structure:**
523+
524+ ```
525+ docs/
526+ ├── en/ # English (source)
527+ ├── ko/ # Korean
528+ ├── ja/ # Japanese
529+ ├── zh/ # Chinese
530+ ├── es/ # Spanish
531+ ├── fr/ # French
532+ ├── de/ # German
533+ ├── css/ # Shared assets
534+ ├── js/
535+ └── img/
536+ ```
537+
538+ ### Troubleshooting
539+
540+ ** Import Error:**
541+ ``` bash
542+ pip install openai anthropic
543+ ```
544+
545+ ** API Key Error:**
546+ ``` bash
547+ export TRANSLATION_API_KEY=" your-key"
548+ ```
549+
550+ ** Build Fails:**
551+ ``` bash
552+ # Ensure docs are in language directories
553+ ls -la docs/en/index.md
554+ ```
555+
556+ For detailed translation guidelines, see [ Translation Guide] ( docs/en/contributing/translation-guide.md ) .
557+
558+ ### Updating Navigation Translations
559+
560+ When you add new documentation pages, update navigation translations:
561+
562+ ** Option 1: Automatic Update (Recommended)**
563+
564+ ``` bash
565+ # Update all language nav translations automatically
566+ python scripts/update_nav_translations.py
567+
568+ # With AI translation for missing items
569+ python scripts/update_nav_translations.py --api-key " your-key"
570+ ```
571+
572+ ** Option 2: Manual Update**
573+
574+ Edit ` mkdocs.yml ` and add translations for each language under ` nav_translations ` :
575+
576+ ``` yaml
577+ - locale : ko
578+ nav_translations :
579+ New Page Title : 새로운 페이지 제목
580+ ` ` `
581+
582+ **Note:** Korean translations should be kept complete. Other languages use basic translations (Home, User Guide, Tutorial, etc.). Native speakers can contribute more detailed translations via PR.
583+
383584## Additional note
384585
385586If you look at source codes, you will see a commentary at the top of the module that describes about the module.
0 commit comments