-
-
Notifications
You must be signed in to change notification settings - Fork 375
doc(Reconnector): update localization #7578
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis 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 flowsequenceDiagram
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
Class diagram for BlazorReconnector localization changesclassDiagram
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"
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this 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
MarkupStringwith 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 ofstring.Format(Localizer["UILibraryDescription2"].Value, WebsiteOption.Value.GetTargets()), prefer the built-in formatter onIStringLocalizer(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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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.
Link issues
fixes #7577
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
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:
Documentation: