Skip to content

feat: allow translations plugins to customize import message and color#1023

Merged
stevenle merged 4 commits intomainfrom
feat/translation-import-result
Apr 3, 2026
Merged

feat: allow translations plugins to customize import message and color#1023
stevenle merged 4 commits intomainfrom
feat/translation-import-result

Conversation

@jeremydw
Copy link
Copy Markdown
Member

@jeremydw jeremydw commented Apr 3, 2026

Summary

Adds support for rich notifications from onImport translation service handlers, matching the existing onExport behavior.

Changes

  • TranslationImportResult type: New interface allowing onImport handlers to return {title, message, link, color} instead of only TranslationRow[]. When a non-array result is returned, the UI displays an informational notification (with optional action button) instead of attempting to merge rows.

  • color property: Added to both TranslationExportResult and TranslationImportResult. Accepts Mantine color names (e.g. green, red, blue) to control notification appearance.

  • UI update: LocalizationModal now checks Array.isArray(resData.data) for import results. Arrays are processed as before; objects are rendered as notifications with optional title, message, link button, and color.

Motivation

Translation services (e.g. Localizer) need to communicate status back to users during import, such as "requests still in progress" or "no pending requests", without throwing errors. Previously the only way to show a message was to throw, which displayed an error-styled notification with no action buttons. Now services can return a TranslationImportResult to show informational notifications with links.

jeremydw added 4 commits April 3, 2026 12:55
…nslation notifications

- Add TranslationImportResult interface so onImport handlers can return
  rich notifications (title, message, link, color) instead of only
  TranslationRow[].
- Add color property to TranslationExportResult for controlling
  notification appearance (uses Mantine color names).
- Update LocalizationModal UI to render action buttons and custom colors
  for both import and export service notifications.
Replace free-form color string with status: 'success' | 'info' | 'error'.
UI maps success to green, error to red, info to undefined (default).
@jeremydw jeremydw changed the title feat(root-cms): add TranslationImportResult and notification color support feat: add TranslationImportResult and notification color support Apr 3, 2026
@jeremydw jeremydw requested a review from stevenle April 3, 2026 20:52
@stevenle stevenle changed the title feat: add TranslationImportResult and notification color support feat: allow translations plugins to customize import message and color Apr 3, 2026
@stevenle stevenle merged commit 94a00f5 into main Apr 3, 2026
1 check passed
@stevenle stevenle deleted the feat/translation-import-result branch April 3, 2026 21:16
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.

2 participants