Convert notification messages to use Ember Intl translation keys #480
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements the requested change to use Ember Intl style translation keys for notification messages instead of hardcoded English strings, enabling proper internationalization support for the frontend application.
Changes Made
Database Schema
message_key(string) andmessage_params(jsonb) columns on the notifications tabledragionfruit_badge_award,blueberrinies_badge_award,beamsprout_badge_awardNotification Model
Completely refactored the
set_messagemethod to use structured translation keys:Before:
After:
API Response
Updated the
NotificationSerializerto include the new fields:message_key: Translation key (e.g., "notifications.badge_award.strawberry")message_params: Parameters for interpolation (e.g.,{ "username": "mcfiredrill" })message: Kept for backward compatibility (empty for new notifications)Translation Key Structure
All notification types now use consistent dot-separated keys:
notifications.badge_award.{fruit_type}notifications.level_up,notifications.experience_point_awardnotifications.fruit_ticket_gift,notifications.supporter_fruit_ticket_stipendnotifications.new_thread,notifications.wiki_page_updatenotifications.shrimpo_started,notifications.shrimpo_entryFrontend Integration
The frontend app can now use these translation keys with Ember Intl:
Backward Compatibility
messagefieldmessagefield but populatedmessage_keyandmessage_paramsmessagefieldDocumentation
Added comprehensive documentation in
docs/notification_translations.mdlisting all translation keys and their required parameters for the frontend team.Testing
Created test coverage for the new translation key functionality to ensure proper key assignment and parameter extraction.
Fixes the internationalization requirement by moving message composition to the frontend where proper translation management can be handled by the datafruits/datafruits application.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.