Quick Reference: .po File Generation and Translationο
This quick reference guide provides the essential steps for generating .po translation files and translating Arabic OS Platform documentation. Use this alongside the comprehensive Translator Setup Guide and Translation Workflow guides.
Prerequisites Checklistο
Required Software:
# Check if you have these installed:
python3 --version # Python 3.8+
git --version # Git 2.20+
# Optional but recommended:
poedit --version # Poedit for GUI translation
Required Setup:
β GitHub account with repository access
β Local repository clone
β Python virtual environment configured
β Sphinx and dependencies installed
Step 1: Environment Setup (5 minutes)ο
Clone and Prepare:
# Clone repository (replace YOUR-USERNAME)
git clone https://github.com/YOUR-USERNAME/documentation
cd documentation/docs
# Create and activate virtual environment
python3 -m venv sphinx-env
source sphinx-env/bin/activate # Linux/macOS
# sphinx-env\Scripts\activate # Windows
# Install dependencies
pip install -r requirements.txt
# Verify Sphinx installation
sphinx-build --version
Step 2: Generate Translation Files (2 minutes)ο
Extract Translatable Strings:
# Extract all translatable messages to .pot files
make gettext
# Alternative command:
# sphinx-build -M gettext source build/gettext
Create/Update Arabic .po Files:
# Generate Arabic translation files
sphinx-intl update -p build/gettext/gettext -l ar
# This creates/updates files in: locales/ar/LC_MESSAGES/
Verify File Generation:
# Check generated files
find locales/ar/LC_MESSAGES -name "*.po" | head -10
# Should show files like:
# locales/ar/LC_MESSAGES/index.po
# locales/ar/LC_MESSAGES/user-guide/index.po
# locales/ar/LC_MESSAGES/developer-guide/index.po
Step 3: Translation Processο
File Structure Overview:
locales/ar/LC_MESSAGES/
βββ index.po # Main page (START HERE)
βββ user-guide/
β βββ index.po # User guide main
β βββ tools/
β βββ cp1256-explorer.po
β βββ utf8-visualizer.po
β βββ [other tools].po
βββ developer-guide/
β βββ index.po
β βββ translation/
β βββ index.po
β βββ [translation docs].po
βββ educator-guide/
βββ [educator files].po
Translation Methods:
Method 1: Poedit (Recommended)
1. Launch Poedit
2. File β Open β Select .po file
3. Translate strings one by one:
- English source β Arabic translation
4. Save frequently (Ctrl+S)
5. File β Compile MO when done
Method 2: Text Editor
# Edit .po files directly
#: source/index.rst:2
msgid "Documentation"
msgstr "Ψ§ΩΩΨ«Ψ§Ψ¦Ω"
#: source/index.rst:4
msgid "Welcome to our platform"
msgstr "Ω
Ψ±ΨΨ¨Ψ§Ω Ψ¨ΩΩ
ΩΩ Ω
ΩΨ΅ΨͺΩΨ§"
Method 3: Web Tools
1. Upload .po file to Weblate/Crowdin
2. Translate online
3. Download completed .po file
4. Replace local file
Priority Translation Order:
Recommended sequence:
1. index.po # Main page
2. user-guide/index.po # User guide overview
3. user-guide/tools/index.po # Tools overview
4. developer-guide/index.po # Developer guide
5. Individual tool files # Specific tools
6. Advanced sections # Reference materials
Step 4: Build and Test (2 minutes)ο
Build Arabic Documentation:
# Build Arabic version
make html-ar
# Alternative:
# sphinx-build -b html -D language=ar source build/html-ar
Verify Translation:
# Check build success
ls build/html-ar/
# Open in browser
open build/html-ar/index.html # macOS
# xdg-open build/html-ar/index.html # Linux
# start build/html-ar/index.html # Windows
Quality Check:
Visual verification:
β Arabic text displays correctly (RTL)
β No English text in Arabic version
β Navigation works properly
β Fonts render correctly
β No layout issues
Common Commands Referenceο
Essential Commands:
Task |
Command |
|---|---|
Generate .po files |
|
Build Arabic docs |
|
Check translation stats |
|
Find untranslated |
|
Clean build |
|
File Operations:
Task |
Command |
|---|---|
List all .po files |
|
Count translations |
|
Backup translations |
|
Troubleshooting Quick Fixesο
Common Issues:
Problem |
Cause |
Solution |
|---|---|---|
βsphinx-build not foundβ |
Virtual environment not active |
|
βNo .po files generatedβ |
gettext step skipped |
|
βArabic text shows as boxesβ |
Missing Arabic fonts |
Install fonts: |
βBuild warningsβ |
Untranslated strings |
Continue translating or ignore |
βRTL layout brokenβ |
CSS/theme issue |
Check browser Arabic support |
Emergency Recovery:
# Reset environment
rm -rf sphinx-env
python3 -m venv sphinx-env
source sphinx-env/bin/activate
pip install -r requirements.txt
# Regenerate .po files
make gettext
sphinx-intl update -p build/gettext/gettext -l ar
Translation Statistics and Progressο
Check Your Progress:
# Overall statistics
find locales/ar/LC_MESSAGES -name "*.po" -exec msgfmt --statistics {} \; | \
awk '{total+=$1; translated+=$4} END {print "Progress: " translated"/"total" ("int(translated/total*100)"%)"}'
# Per-file progress
for file in locales/ar/LC_MESSAGES/*.po; do
echo "=== $(basename $file) ==="
msgfmt --statistics "$file"
done
Translation Priorities:
High Priority (User-facing):
β‘ index.po # Main landing page
β‘ user-guide/index.po # Getting started
β‘ user-guide/tools/index.po # Tools overview
Medium Priority (Educational):
β‘ user-guide/tools/*.po # Individual tools
β‘ developer-guide/index.po # Developer overview
Low Priority (Reference):
β‘ developer-guide/api/*.po # API documentation
β‘ reference/*.po # Technical reference
Quick Start Workflow Summaryο
Complete Workflow (15 minutes):
# 1. Setup (once)
git clone https://github.com/YOUR-USERNAME/documentation
cd documentation/docs
python3 -m venv sphinx-env
source sphinx-env/bin/activate
pip install -r requirements.txt
# 2. Generate files (each update)
make gettext
sphinx-intl update -p build/gettext/gettext -l ar
# 3. Translate (ongoing)
poedit locales/ar/LC_MESSAGES/index.po
# OR edit directly with text editor
# 4. Test
make html-ar
open build/html-ar/index.html
# 5. Commit
git add locales/ar/LC_MESSAGES/
git commit -m "Add Arabic translations"
git push origin your-branch
Next Steps:
Review Arabic Style Guide for translation standards
Join translator community channels
Request assignment for specific documentation sections
Follow Translation Quality Assurance process for review
Success Metrics:
Week 1: Complete environment setup, translate 1-2 small files
Week 2: Complete major index page translations
Month 1: Significant contribution to user-facing documentation
Ongoing: Regular contributions, help onboard new translators
This quick reference covers the essential workflow. For detailed explanations, troubleshooting, and best practices, refer to the comprehensive guides in this section.