feat: add internationalization support and update translation files#6
feat: add internationalization support and update translation files#6
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements internationalization (i18n) support for the Games XBlock by migrating from a placeholder translations directory to a fully configured locale directory structure following Django/Open edX i18n conventions. The changes wrap all user-facing strings in translation functions and set up the infrastructure for multi-language support.
Key Changes
- Migrated from
games/translationstogames/localedirectory structure with proper i18n tooling configuration - Wrapped all help texts in field definitions with
gettext_lazyand runtime strings withgettextfor proper translation support - Added Makefile targets for extracting and compiling translations using edX's i18n_tool
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| setup.py | Updated package_data to include locale directory instead of translations |
| games/translations/README.txt | Removed placeholder translations documentation |
| games/locale/en/LC_MESSAGES/django.po | Added English source translation catalog with all translatable strings |
| games/locale/en/LC_MESSAGES/django.mo | Added compiled translation file for English locale |
| games/locale/config.yaml | Added i18n_tool configuration specifying source locale, dummy locales, and merge settings |
| games/locale/README.md | Added documentation for translation workflow including extraction and compilation commands |
| games/handlers/common.py | Wrapped runtime strings (descriptions, error messages) with gettext translation function |
| games/games.py | Wrapped field help texts with gettext_lazy for proper lazy evaluation in class definitions |
| Makefile | Added targets for extracting translatable strings and compiling translations for multiple locales |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def expand_game(xblock, data, suffix=''): | ||
| """A handler to expand the game from its title block.""" | ||
| description = "ERR: self.game_type not defined or invalid" | ||
| description = _("ERR: self.game_type not defined or invalid") |
There was a problem hiding this comment.
This error message is intended for debugging but will be shown to end users and translators. Consider either removing the 'ERR:' prefix for a user-friendly message like 'Invalid game type' or logging this as a system error instead of displaying it.
| description = _("ERR: self.game_type not defined or invalid") | |
| description = _("Invalid or unsupported game type.") |
| def display_help(xblock, data, suffix=''): | ||
| """A handler to display a tooltip message above the help icon.""" | ||
| message = "ERR: self.game_type not defined or invalid" | ||
| message = _("ERR: self.game_type not defined or invalid") |
There was a problem hiding this comment.
This error message is intended for debugging but will be shown to end users and translators. Consider either removing the 'ERR:' prefix for a user-friendly message like 'Invalid game type' or logging this as a system error instead of displaying it.
| message = _("ERR: self.game_type not defined or invalid") | |
| message = _("Invalid or unsupported game type.") |
No description provided.