feat: add i18n support (en/zh) and enhance webhook notifications with custom templates #430

Closed
opened 2026-04-05 16:16:27 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @CoderKuo on 11/6/2025

feat: add i18n support (en/zh) and enhance webhook notifications with custom templates

This PR introduces two major enhancements:

1. Internationalization (i18n) Support

  • Adds react-i18next and i18next for robust translation management
  • Provides full English and Chinese (en/zh) translations across all modules
  • Replaces all hardcoded UI strings with t() translation calls
  • Introduces a LanguageSwitcher component in the navbar for seamless language toggling
  • Organizes translations into namespaces: common, database, storage, notifier, backup, restore, healthcheck, user

2. Advanced Webhook Notification Templates

  • Adds a custom_template field to the webhook_notifiers table (with DB migration)
  • Refactors the notification system to use map[string]string for fine-grained variables
  • Supports powerful recursive JSON template parsing with variable replacement
  • Introduces granular variables:
    {{status}}, {{status_text}}, {{database_name}}, {{duration}}, {{size}}, {{error}}
    (while maintaining backward compatibility with {{heading}} and {{message}})
  • Updates all notifier types (email, Telegram, Slack, Discord, Teams) to use the new variable system
  • Frontend improvements:
    • Custom template editor with toggle switch
    • 8 variable insertion buttons with tooltips
    • Real-time preview of example webhook requests
    • Support for both POST (JSON body) and GET (query params) methods
    • Preset template for WeWork (企业微信) to ease enterprise integration

These changes enable users to fully customize notification formats and localize the UI—critical for global deployments and integrations with systems like DingTalk, WeWork, and internal enterprise tools.

*Originally created by @CoderKuo on 11/6/2025* feat: add i18n support (en/zh) and enhance webhook notifications with custom templates This PR introduces two major enhancements: #### 1. **Internationalization (i18n) Support** - Adds `react-i18next` and `i18next` for robust translation management - Provides full English and Chinese (en/zh) translations across all modules - Replaces all hardcoded UI strings with `t()` translation calls - Introduces a `LanguageSwitcher` component in the navbar for seamless language toggling - Organizes translations into namespaces: `common`, `database`, `storage`, `notifier`, `backup`, `restore`, `healthcheck`, `user` #### 2. **Advanced Webhook Notification Templates** - Adds a `custom_template` field to the `webhook_notifiers` table (with DB migration) - Refactors the notification system to use `map[string]string` for fine-grained variables - Supports powerful recursive JSON template parsing with variable replacement - Introduces granular variables: `{{status}}`, `{{status_text}}`, `{{database_name}}`, `{{duration}}`, `{{size}}`, `{{error}}` (while maintaining backward compatibility with `{{heading}}` and `{{message}}`) - Updates **all notifier types** (email, Telegram, Slack, Discord, Teams) to use the new variable system - **Frontend improvements**: - Custom template editor with toggle switch - 8 variable insertion buttons with tooltips - Real-time preview of example webhook requests - Support for both **POST (JSON body)** and **GET (query params)** methods - Preset template for **WeWork (企业微信)** to ease enterprise integration These changes enable users to fully customize notification formats and localize the UI—critical for global deployments and integrations with systems like DingTalk, WeWork, and internal enterprise tools.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/databasus#430