Skip to content

Latest commit

 

History

History
191 lines (148 loc) · 5.94 KB

File metadata and controls

191 lines (148 loc) · 5.94 KB

Internationalization Implementation Summary

✅ Completed Tasks

1. Configuration Files Updated

source/conf.py

  • ✅ Added internationalization settings
  • ✅ Configured locale_dirs, gettext_compact, gettext_uuid, and gettext_auto_build
  • ✅ Defined supported languages: English (en) and Russian (ru)
  • ✅ Added html_context with language names for the selector
  • ✅ Updated html_sidebars to include language selector at the top

requirements.txt

  • ✅ Added sphinx-intl>=2.0.0 dependency

2. Templates and Styling

source/_templates/language_selector.html

  • ✅ Created language selector dropdown with all available languages
  • ✅ Added JavaScript for language switching functionality
  • ✅ Handles URL path transformation for different languages

source/_static/globals.css

  • ✅ Added comprehensive styling for language selector
  • ✅ Styled dropdown, label, and hover/focus states
  • ✅ Responsive design that fits the RTD theme sidebar

3. Build System

Makefile

  • ✅ Added gettext target - extracts translatable messages
  • ✅ Added update-po target - updates PO files for all languages
  • ✅ Added build-all target - builds all language versions

build_all_languages.sh

  • ✅ Created comprehensive build script with progress indicators
  • ✅ Extracts messages → Updates PO files → Builds all languages
  • ✅ Error handling and status messages
  • ✅ Made executable with proper permissions

4. Translation Files

English PO Files Created (Source Language)

  • source/locale/en/LC_MESSAGES/*.po - 34 PO files created
  • ✅ Includes all documentation sections:
    • Main pages (index, faq)
    • User guides (all 20 guide files)
    • API documentation (4 API files)
    • Technical docs

5. Documentation

I18N_GUIDE.md

  • ✅ Complete internationalization guide
  • ✅ Step-by-step workflow for translators
  • ✅ Instructions for adding new languages
  • ✅ Troubleshooting section
  • ✅ Best practices and resources

.gitignore

  • ⚠️ File already exists - recommend adding .mo files to it

📁 New Directory Structure

mapflow-docs-en/
├── source/
│   ├── locale/
│   │   ├── en/                    # NEW: English source PO files
│   │   │   └── LC_MESSAGES/
│   │   │       ├── index.po
│   │   │       ├── faq.po
│   │   │       ├── userguides/
│   │   │       │   └── *.po (20 files)
│   │   │       └── api/
│   │   │           └── *.po (4 files)
│   │   ├── ru/                    # EXISTING: Russian translations
│   │   └── *.pot                  # GENERATED: Template files
│   ├── _templates/
│   │   └── language_selector.html # NEW: Language switcher
│   ├── _static/
│   │   └── globals.css            # UPDATED: Added language selector styles
│   └── conf.py                    # UPDATED: i18n configuration
├── build/
│   └── docs/
│       ├── en/                    # NEW: English HTML output
│       └── ru/                    # NEW: Russian HTML output
├── build_all_languages.sh         # NEW: Comprehensive build script
├── Makefile                       # UPDATED: Added i18n targets
├── requirements.txt               # UPDATED: Added sphinx-intl
├── I18N_GUIDE.md                  # NEW: Documentation
└── .gitignore                     # EXISTING (recommend update)

🚀 Usage

For Developers (Content Updates)

When you update RST files:

# Extract new translatable strings and update PO files
make update-po

# Build all language versions
make build-all

For Translators

  1. Open PO files in source/locale/[LANG]/LC_MESSAGES/
  2. Translate the msgstr values
  3. Build and preview:
    ./build_all_languages.sh

Adding a New Language (e.g., Spanish)

  1. Edit source/conf.py:

    • Add 'es' to languages list
    • Add ('Español', 'es') to html_context['languages']
  2. Create PO files:

    sphinx-intl update -p source/locale -l es
  3. Update build scripts (Makefile and build_all_languages.sh)

  4. Translate and build:

    ./build_all_languages.sh

🎯 Current State

  • English: Complete source PO files (34 files)
  • Russian: Existing translations ready to be updated
  • Language Selector: Fully functional in sidebar
  • Build System: Automated with make commands and shell script
  • Documentation: Complete guide available

📋 Next Steps

  1. Review English PO files - Ensure all source text is correct
  2. Update Russian translations - Run make update-po to sync with new structure
  3. Test build - Run ./build_all_languages.sh to verify everything works
  4. Update .gitignore - Add *.mo files to exclude compiled translations
  5. Add more languages - Follow the guide in I18N_GUIDE.md

🔗 Key Files

  • Configuration: source/conf.py
  • Language Selector: source/_templates/language_selector.html
  • Styles: source/_static/globals.css
  • Build Script: ./build_all_languages.sh
  • Makefile: ./Makefile
  • Documentation: ./I18N_GUIDE.md
  • Source Translations: source/locale/en/LC_MESSAGES/*.po

⚙️ Commands Reference

# Extract messages from RST files
make gettext

# Update all PO files
make update-po

# Build all languages
make build-all

# Or use the comprehensive script
./build_all_languages.sh

# Build specific language
sphinx-build -b html source build/docs/en
sphinx-build -b html -D language=ru source build/docs/ru

🎉 Benefits

✅ Professional internationalization setup using industry-standard gettext ✅ Separation of source and translated content ✅ Easy to add new languages ✅ Automated build process ✅ Version control friendly ✅ Language selector in sidebar for easy switching ✅ Comprehensive documentation for maintainers and translators