Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Jan 25, 2026

Link issues

fixes #7577

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

Localize the BlazorReconnector component by replacing hardcoded UI text with resource-based strings and wiring it to the existing localization system.

Enhancements:

  • Inject a string localizer into the BlazorReconnector component and replace hardcoded Chinese text with localized resource keys for reconnect states and UI library information.

Documentation:

  • Improve user-facing reconnect and UI library descriptions to support multiple languages via localization resources.

Copilot AI review requested due to automatic review settings January 25, 2026 05:14
@bb-auto bb-auto bot added the documentation Improvements or additions to documentation label Jan 25, 2026
@bb-auto bb-auto bot added this to the v10.2.0 milestone Jan 25, 2026
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 25, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR localizes the Blazor reconnect UI by replacing hard-coded Chinese strings in the Reconnector component with IStringLocalizer-based resources and wiring up corresponding entries in the locale JSON files.

Sequence diagram for localized Blazor reconnect flow

sequenceDiagram
    actor User
    participant Browser
    participant BlazorReconnector
    participant IStringLocalizer_BalzorReconnector as IStringLocalizer_BalzorReconnector
    participant LocaleStore as LocaleJsonFiles

    User->>Browser: Trigger reconnect view
    Browser->>BlazorReconnector: Render component
    BlazorReconnector->>IStringLocalizer_BalzorReconnector: Get Title
    IStringLocalizer_BalzorReconnector->>LocaleStore: Resolve Title for current culture
    LocaleStore-->>IStringLocalizer_BalzorReconnector: Localized Title
    IStringLocalizer_BalzorReconnector-->>BlazorReconnector: Localized Title

    BlazorReconnector->>IStringLocalizer_BalzorReconnector: Get ReconnectingDescription
    IStringLocalizer_BalzorReconnector->>LocaleStore: Resolve ReconnectingDescription
    LocaleStore-->>IStringLocalizer_BalzorReconnector: Localized HTML string
    IStringLocalizer_BalzorReconnector-->>BlazorReconnector: Localized HTML string

    BlazorReconnector-->>Browser: Render localized reconnect UI
    Browser-->>User: Display localized reconnect messages
Loading

Class diagram for BlazorReconnector localization changes

classDiagram
    class BlazorReconnector {
        +RenderFragment RenderBootstrapBlazor
        +IOptions_WebsiteOptions WebsiteOption
        +IStringLocalizer_BlazorReconnector Localizer
    }

    class IOptions_WebsiteOptions {
        +WebsiteOptions Value
    }

    class WebsiteOptions {
        +string GetTargets()
        +string GetAssetUrl(string path)
    }

    class IStringLocalizer_BlazorReconnector {
        +LocalizedString indexer[string key]
    }

    class LocalizedString {
        +string Value
    }

    BlazorReconnector --> IOptions_WebsiteOptions : injects
    BlazorReconnector --> IStringLocalizer_BlazorReconnector : injects
    IOptions_WebsiteOptions --> WebsiteOptions : wraps
    IStringLocalizer_BlazorReconnector --> LocalizedString : returns

    note for BlazorReconnector "Hard coded Chinese strings replaced by Localizer indexer lookups for keys such as Title, ReconnectingTitle, ReconnectFailedTitle, ReconnectRejectedTitle, ReconnectButton, ReloadButton, UILibraryTitle, UILibraryDescription1, UILibraryDescription2, TemplateText, TemplateLink"
Loading

File-Level Changes

Change Details Files
Introduce localization into the BlazorReconnector component and replace hard-coded UI text with localized resources.
  • Inject IStringLocalizer into the component for string lookup.
  • Replace all hard-coded Chinese headings, descriptions, and button labels in reconnecting, failed, and rejected states with Localizer[...] keys.
  • Render description strings as MarkupString to support rich HTML content in localized text.
  • Localize the Bootstrap Blazor UI library section title, descriptions, and template link text, including using string.Format with localized templates and WebsiteOption.Value.GetTargets().
src/BootstrapBlazor.Server/Components/Components/BlazorReconnector.razor
Add or update localization resources for the Reconnector component in existing locale JSON files.
  • Define localization keys used by BlazorReconnector (titles, descriptions, and button labels) in the English locale file.
  • Define equivalent Chinese translations for the same keys in the zh-CN locale file.
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json

Assessment against linked issues

Issue Objective Addressed Explanation
#7577 Update the Reconnector demo/component to use localization (IStringLocalizer) instead of hard-coded strings.
#7577 Provide/adjust localization resources (e.g., locale JSON files) so the Reconnector’s UI text is properly localized.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ArgoZhang ArgoZhang merged commit c267223 into main Jan 25, 2026
8 checks passed
@ArgoZhang ArgoZhang deleted the doc-reconnector branch January 25, 2026 05:14
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've left some high level feedback:

  • Using MarkupString with localized values (e.g., Localizer["ReconnectingDescription"].Value) assumes the localized content is safe HTML; if any of these strings can be influenced externally, consider sanitizing or using a more constrained formatting approach to avoid XSS risks.
  • For UILibraryDescription2, instead of string.Format(Localizer["UILibraryDescription2"].Value, WebsiteOption.Value.GetTargets()), prefer the built-in formatter on IStringLocalizer (e.g., Localizer["UILibraryDescription2", WebsiteOption.Value.GetTargets()]) to better support pluralization and future localization nuances.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Using `MarkupString` with localized values (e.g., `Localizer["ReconnectingDescription"].Value`) assumes the localized content is safe HTML; if any of these strings can be influenced externally, consider sanitizing or using a more constrained formatting approach to avoid XSS risks.
- For `UILibraryDescription2`, instead of `string.Format(Localizer["UILibraryDescription2"].Value, WebsiteOption.Value.GetTargets())`, prefer the built-in formatter on `IStringLocalizer` (e.g., `Localizer["UILibraryDescription2", WebsiteOption.Value.GetTargets()]`) to better support pluralization and future localization nuances.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Jan 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (65a44f0) to head (7fb38f6).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7578   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          749       749           
  Lines        32976     32976           
  Branches      4580      4580           
=========================================
  Hits         32976     32976           
Flag Coverage Δ
BB 100.00% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
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 pull request adds internationalization support to the BlazorReconnector component by replacing hardcoded Chinese text with localized strings. The component now properly supports both Chinese (zh-CN) and English (en-US) locales.

Changes:

  • Added localization resource keys for the BlazorReconnector component in both zh-CN and en-US locale files
  • Updated BlazorReconnector component to use IStringLocalizer for all display text
  • Replaced all hardcoded Chinese strings with references to localized resources

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
src/BootstrapBlazor.Server/Locales/zh-CN.json Added Chinese translations for all BlazorReconnector component strings
src/BootstrapBlazor.Server/Locales/en-US.json Added English translations for all BlazorReconnector component strings
src/BootstrapBlazor.Server/Components/Components/BlazorReconnector.razor Injected IStringLocalizer and replaced hardcoded strings with localized text throughout all reconnection templates

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc(Reconnector): update localization

2 participants