[PR #16633] feat: Implement banner internationalization #47240

Open
opened 2026-04-29 22:23:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/16633
Author: @Rain6435
Created: 8/14/2025
Status: 🔄 Open

Base: devHead: feat/banner-internationalization


📝 Commits (5)

  • 9ce29c6 feat: Implement banner internationalization
  • e21f9f7 feat: Add translation for "Search all emojis" to fix conflict
  • 857cf18 Merge branch 'dev' into feat/banner-internationalization
  • 16c472e feat: Enhance banner translation handling and update content retrieval logic
  • 1176e6c fix formatting

📊 Changes

5 files changed (+444 additions, -38 deletions)

View changed files

📝 backend/open_webui/config.py (+1 -0)
📝 src/lib/components/admin/Settings/Interface/Banners.svelte (+423 -37)
📝 src/lib/components/common/Banner.svelte (+13 -1)
📝 src/lib/i18n/locales/en-US/translation.json (+6 -0)
📝 src/lib/types/index.ts (+1 -0)

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • feat: Introduces a new feature or enhancement to the codebase

Changelog Entry

Description

This PR introduces internationalization (i18n) support for system-wide banners, enabling administrators to create and manage banner content in multiple languages. This ensures that users see announcements and important information in their preferred language, enhancing the user experience for a global audience.

Added

  • Multi-language Banner Content:
    • The BannerModel on the backend and the Banner type on the frontend now support an optional translations field, which stores a mapping of language codes to translated content.
  • Translation Management UI:
    • A new, intuitive interface in the admin settings allows for the seamless addition, editing, and removal of translations for each banner.
    • A language search feature has been integrated to help administrators quickly find and add supported languages.
  • Dynamic Content Display:
    • The Banner.svelte component now intelligently displays the appropriate translation based on the user's current language setting, falling back to the default content if a specific translation is not available.

Changed

  • The user interface for managing banners in the admin settings has been redesigned to accommodate the new translation management features, improving usability and workflow.
  • The Banner.svelte component has been updated to prioritize and render translated content when available.

API Endpoints

No new API endpoints have been added. The existing endpoints for banner management have been updated to handle the new translations field in the request and response payloads.

Example Banner Object with Translations:

{
    "id": "c5a6b7d8-e9f0-1234-5678-9abcdef01234",
    "type": "info",
    "content": "This is the default banner content in English.",
    "dismissible": true,
    "timestamp": 1678886400,
    "translations": {
        "es-ES": "Este es el contenido del banner en español.",
        "fr-FR": "Ceci est le contenu de la bannière en français.",
        "de-DE": "Dies ist der Bannerinhalt auf Deutsch."
    }
}

Screen-recording

https://github.com/user-attachments/assets/6cb3dc61-2179-4bad-bc0e-778f7c55cf5a

Test Plan

  • Backend:
    • Verify that banner creation and updates correctly handle the translations object.
    • Ensure that the translations field is properly stored in and retrieved from the database.
  • Frontend (Admin Panel):
    • Test the full CRUD functionality for translations: add a new language, update its content, and remove it.
    • Verify that the language search functionality works as expected.
    • Confirm that changes to translations are saved correctly when the main "Save" button is clicked.
  • Frontend (User View):
    • Switch the UI language and verify that the banner displays the correct translation.
    • Confirm that the banner falls back to the default content if the current language's translation is missing.
    • Ensure the banner displays correctly for languages with no translations and for banners with no translations field at all.

Benefits

For Users:

  • Receive important announcements and information in their native language, improving clarity and accessibility.

For Administrators:

  • Easily manage and deliver localized content to a diverse, global user base from a single, centralized interface.
  • Enhanced ability to communicate effectively with users in different regions.

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to
the Contributor License Agreement (CLA), and
I am providing my contributions under its terms.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/16633 **Author:** [@Rain6435](https://github.com/Rain6435) **Created:** 8/14/2025 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `feat/banner-internationalization` --- ### 📝 Commits (5) - [`9ce29c6`](https://github.com/open-webui/open-webui/commit/9ce29c675d1e93bcef238dce9062768e2a7ba484) feat: Implement banner internationalization - [`e21f9f7`](https://github.com/open-webui/open-webui/commit/e21f9f7ec788e8fac4722a14015d0b4d21960f49) feat: Add translation for "Search all emojis" to fix conflict - [`857cf18`](https://github.com/open-webui/open-webui/commit/857cf18ab173f88ca7b4b70e32bdb077d0f78d37) Merge branch 'dev' into feat/banner-internationalization - [`16c472e`](https://github.com/open-webui/open-webui/commit/16c472e2d8e1bc42a27e22ebaa5f90f553c533e6) feat: Enhance banner translation handling and update content retrieval logic - [`1176e6c`](https://github.com/open-webui/open-webui/commit/1176e6cf276a3ad0c822828b335a7a824908cea7) fix formatting ### 📊 Changes **5 files changed** (+444 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+1 -0) 📝 `src/lib/components/admin/Settings/Interface/Banners.svelte` (+423 -37) 📝 `src/lib/components/common/Banner.svelte` (+13 -1) 📝 `src/lib/i18n/locales/en-US/translation.json` (+6 -0) 📝 `src/lib/types/index.ts` (+1 -0) </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** * [x] **Target branch:** Please verify that the pull request targets the `dev` branch. * [x] **Description:** Provide a concise description of the changes made in this pull request. * [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. * [x] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? * [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? * [x] **Testing:** Have you written and run sufficient tests to validate the changes? * [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? * [x] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: * **feat**: Introduces a new feature or enhancement to the codebase # Changelog Entry ### Description This PR introduces internationalization (i18n) support for system-wide banners, enabling administrators to create and manage banner content in multiple languages. This ensures that users see announcements and important information in their preferred language, enhancing the user experience for a global audience. ### Added * **Multi-language Banner Content**: * The `BannerModel` on the backend and the `Banner` type on the frontend now support an optional `translations` field, which stores a mapping of language codes to translated content. * **Translation Management UI**: * A new, intuitive interface in the admin settings allows for the seamless addition, editing, and removal of translations for each banner. * A language search feature has been integrated to help administrators quickly find and add supported languages. * **Dynamic Content Display**: * The `Banner.svelte` component now intelligently displays the appropriate translation based on the user's current language setting, falling back to the default content if a specific translation is not available. ### Changed * The user interface for managing banners in the admin settings has been redesigned to accommodate the new translation management features, improving usability and workflow. * The `Banner.svelte` component has been updated to prioritize and render translated content when available. ### API Endpoints No new API endpoints have been added. The existing endpoints for banner management have been updated to handle the new `translations` field in the request and response payloads. **Example Banner Object with Translations:** ```json { "id": "c5a6b7d8-e9f0-1234-5678-9abcdef01234", "type": "info", "content": "This is the default banner content in English.", "dismissible": true, "timestamp": 1678886400, "translations": { "es-ES": "Este es el contenido del banner en español.", "fr-FR": "Ceci est le contenu de la bannière en français.", "de-DE": "Dies ist der Bannerinhalt auf Deutsch." } } ``` ### Screen-recording https://github.com/user-attachments/assets/6cb3dc61-2179-4bad-bc0e-778f7c55cf5a ### Test Plan * **Backend**: * Verify that banner creation and updates correctly handle the `translations` object. * Ensure that the `translations` field is properly stored in and retrieved from the database. * **Frontend (Admin Panel)**: * Test the full CRUD functionality for translations: add a new language, update its content, and remove it. * Verify that the language search functionality works as expected. * Confirm that changes to translations are saved correctly when the main "Save" button is clicked. * **Frontend (User View)**: * Switch the UI language and verify that the banner displays the correct translation. * Confirm that the banner falls back to the default content if the current language's translation is missing. * Ensure the banner displays correctly for languages with no translations and for banners with no `translations` field at all. ### Benefits **For Users:** * Receive important announcements and information in their native language, improving clarity and accessibility. **For Administrators:** * Easily manage and deliver localized content to a diverse, global user base from a single, centralized interface. * Enhanced ability to communicate effectively with users in different regions. ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-29 22:23:47 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#47240