mirror of
https://github.com/DRYTRIX/TimeTracker.git
synced 2025-12-31 00:09:58 -06:00
Add complete internationalization (i18n) infrastructure supporting 9 languages including full Right-to-Left (RTL) support for Arabic and Hebrew. Languages supported: - English, German, French, Spanish, Dutch, Italian, Finnish (LTR) - Arabic, Hebrew (RTL with complete layout support) Core features: * Flask-Babel configuration with locale selector * Translation files for all 9 languages (480+ strings each) * Language selector UI component in header with globe icon * User language preference storage in database * RTL CSS support with automatic layout reversal * Session and user-based language persistence Model field translation system: * Created comprehensive i18n helper utilities (app/utils/i18n_helpers.py) * 17 new Jinja2 template filters for automatic translation * Support for task statuses, priorities, project statuses, invoice statuses, payment methods, expense categories, and all model enum fields * Status badge CSS classes for consistent styling Technical implementation: * Language switching via API endpoint (POST /api/language) * Direct language switching route (GET /set-language/<lang>) * RTL detection and automatic dir="rtl" attribute * Context processors for language information in all templates * Template filters registered globally Testing and quality: * 50+ unit tests covering all i18n functionality * Tests for locale selection, language switching, RTL detection * Comprehensive test coverage for all translation features Files added: - translations/es/LC_MESSAGES/messages.po (Spanish) - translations/ar/LC_MESSAGES/messages.po (Arabic) - translations/he/LC_MESSAGES/messages.po (Hebrew) - app/utils/i18n_helpers.py (translation helper functions) - app/static/css/rtl-support.css (RTL layout support) - tests/test_i18n.py (comprehensive test suite) - scripts/audit_i18n.py (translation audit tool) Files modified: - app/config.py: Added 3 languages + RTL configuration - app/routes/user.py: Language switching endpoints - app/templates/base.html: Language selector + RTL support - app/utils/context_processors.py: Language context injection - app/__init__.py: Registered i18n template filters - scripts/extract_translations.py: Updated language list - translations/*/messages.po: Added 70+ model field translations The infrastructure is production-ready. Model enum fields now automatically translate in templates using the new filters. Flash messages and some template strings remain in English until wrapped with translation markers (tracked separately for incremental implementation).