Add Multi-language Support (i18n) for Backend and Frontend#8
Add Multi-language Support (i18n) for Backend and Frontend#8google-labs-jules[bot] wants to merge 2 commits intomasterfrom
Conversation
- Updated backend `messages.py` with translation keys for all supported languages (en, es, ca, de, zh-CN, hi). - Implemented `language_service.py` to detect requested language from `Accept-Language` header or query param. - Updated backend API routes (`main.py`, `inventory_routes.py`) to return localized error messages. - Updated frontend translation files (`front/public/i18n/*.json`) with missing keys for inventory, units, and categories. - Updated Angular components (`products.component.ts`, `inventory-items.component.ts`) to use localized strings for dynamic content and errors.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
- Updated backend `messages.py` with ALL missing translation keys for `main.py` and `inventory_routes.py`. - Fixed `back/app/language_service.py` to correctly read `Accept-Language` header using `Header` instead of `Query`. - Ensured `front/public/i18n/*.json` files are 100% synchronized, filling missing keys in es, ca, de, zh-CN, and hi. - Verified all code changes and translations.
This pull request implements comprehensive internationalization (i18n) support for the POS application.
Backend Changes:
back/app/messages.pyto store and retrieve localized strings for 6 languages: English, Spanish, Catalan, German, Chinese, and Hindi.back/app/language_service.pyto parse theAccept-Languageheader orlangquery parameter, normalizing language codes (e.g.,zh->zh-CN).back/app/main.pyandback/app/inventory_routes.pyto inject the detected language and useget_message()for generatingHTTPExceptiondetails, ensuring API errors are returned in the user's preferred language.Frontend Changes:
front/public/i18n/to include missing translation keys for:INVENTORY.CATEGORIES.INGREDIENTS)INVENTORY.UNITS.PIECE)CATALOG.ALL_CATEGORIES)NONE.ProductsComponent: Now usestranslatepipe for category filters andtranslateServicefor API error messages.InventoryItemsComponent: Replaced hardcoded string formatting for categories and units with dynamic translations using the new JSON structure.This ensures a consistent multi-language experience across both the UI and API responses.
PR created automatically by Jules for task 15334820750941838496 started by @wiatakillo