Skip to content

feat: add internationalization support and update translation files#6

Merged
papphelix merged 2 commits intomainfrom
feat/translations
Nov 21, 2025
Merged

feat: add internationalization support and update translation files#6
papphelix merged 2 commits intomainfrom
feat/translations

Conversation

@papphelix
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings November 21, 2025 08:22
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/translations to games/locale directory structure with proper i18n tooling configuration
  • Wrapped all help texts in field definitions with gettext_lazy and runtime strings with gettext for 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.

Comment thread games/locale/en/LC_MESSAGES/django.po
Comment thread games/locale/README.md Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings November 21, 2025 08:34
@papphelix papphelix merged commit d481a9b into main Nov 21, 2025
4 checks passed
@papphelix papphelix deleted the feat/translations branch November 21, 2025 08:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread games/handlers/common.py
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")
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
description = _("ERR: self.game_type not defined or invalid")
description = _("Invalid or unsupported game type.")

Copilot uses AI. Check for mistakes.
Comment thread games/handlers/common.py
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")
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
message = _("ERR: self.game_type not defined or invalid")
message = _("Invalid or unsupported game type.")

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants