Skip to content

doc(HostModel): support en-US language#8044

Merged
ArgoZhang merged 1 commit into
mainfrom
doc-host
May 23, 2026
Merged

doc(HostModel): support en-US language#8044
ArgoZhang merged 1 commit into
mainfrom
doc-host

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented May 23, 2026

Link issues

fixes #8043

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 HostModel Blazor demo page and add support for en-US content.

New Features:

  • Introduce localization for the HostModel page using IStringLocalizer so it can display content in en-US and zh-CN.

Enhancements:

  • Replace hard-coded Chinese text on the HostModel page with localized resources for headings, introductory text, and recommendations.

Documentation:

  • Update localized resource files to include HostModel page strings in both en-US and zh-CN.

Copilot AI review requested due to automatic review settings May 23, 2026 03:50
@bb-auto bb-auto Bot added the documentation Improvements or additions to documentation label May 23, 2026
@bb-auto bb-auto Bot added this to the v10.6.0 milestone May 23, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 23, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Localizes the HostModel Blazor documentation page by replacing hard-coded Chinese text with IStringLocalizer-based resources and wiring up en-US/zh-CN locale entries to support English and Chinese content.

Sequence diagram for localized HostModel page rendering

sequenceDiagram
    actor User
    participant Browser
    participant HostModel
    participant IStringLocalizer_HostModel_ as IStringLocalizer_HostModel

    User ->> Browser: Request /host-model
    Browser ->> HostModel: Render HostModel
    HostModel ->> IStringLocalizer_HostModel: Item[Title]
    IStringLocalizer_HostModel -->> HostModel: "Title" string
    HostModel ->> IStringLocalizer_HostModel: Item[Recommended]
    IStringLocalizer_HostModel -->> HostModel: "Recommended" string
    HostModel -->> Browser: Localized HTML content
    Browser -->> User: Display localized HostModel page
Loading

File-Level Changes

Change Details Files
Replace hard-coded Chinese UI text in HostModel page with IStringLocalizer-backed resources to support localization, including HTML-capable content segments.
  • Inject IStringLocalizer into the HostModel.razor component.
  • Replace the static Chinese page title with a localized string key (Title).
  • Replace introductory and explanatory paragraphs with Localizer-based lookups, using MarkupString for entries that contain inline HTML such as tags or bold text.
  • Replace hard-coded '(新手强烈推荐)' annotations with a reusable localized Recommended string key for both hosting model and render mode lists.
src/BootstrapBlazor.Server/Components/Pages/HostModel.razor
Add or update resource entries for HostModel localization in both English and Chinese locale JSON files.
  • Define en-US translations for HostModel strings such as title, introduction, and recommendation notes using keys referenced in HostModel.razor (e.g., Title, HostModelsIntro, RecommendServer, CreateProject, RenderModeIntro, InteractivityLocationIntro, Recommended).
  • Add corresponding zh-CN entries keyed identically so the previous Chinese content is preserved via localization rather than hard-coded text.
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json

Assessment against linked issues

Issue Objective Addressed Explanation
#8043 Refactor the HostModel documentation page to use localization (IStringLocalizer) instead of hard-coded text.
#8043 Provide en-US (and corresponding zh-CN) localized strings for all text used on the HostModel documentation page so that en-US language is supported.

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 1b602ee into main May 23, 2026
4 checks passed
@ArgoZhang ArgoZhang deleted the doc-host branch May 23, 2026 03:50
Copy link
Copy Markdown
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:

  • Where you cast localized strings to MarkupString (e.g., @((MarkupString)Localizer["RecommendServer"].Value)), consider whether HTML is truly required; if not, render as plain text to avoid unnecessary HTML allowance and potential XSS risks from future resource changes.
  • The "Recommended" key is reused for different contexts (hosting model, render mode, interactivity); giving these keys more specific names (e.g., RecommendedForBeginners, RecommendedRenderMode) will make future translation and maintenance clearer.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Where you cast localized strings to MarkupString (e.g., `@((MarkupString)Localizer["RecommendServer"].Value)`), consider whether HTML is truly required; if not, render as plain text to avoid unnecessary HTML allowance and potential XSS risks from future resource changes.
- The `"Recommended"` key is reused for different contexts (hosting model, render mode, interactivity); giving these keys more specific names (e.g., `RecommendedForBeginners`, `RecommendedRenderMode`) will make future translation and maintenance clearer.

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.

Copy link
Copy Markdown
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 PR updates the HostModel documentation page to support English (en-US) by switching the page content to use IStringLocalizer and adding the corresponding locale entries.

Changes:

  • Localized HostModel.razor by replacing hard-coded Chinese text with IStringLocalizer<HostModel> lookups.
  • Added BootstrapBlazor.Server.Components.Pages.HostModel translation entries to both zh-CN.json and en-US.json.

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 Adds HostModel page localization keys/values for Simplified Chinese.
src/BootstrapBlazor.Server/Locales/en-US.json Adds HostModel page localization keys/values for US English.
src/BootstrapBlazor.Server/Components/Pages/HostModel.razor Injects IStringLocalizer<HostModel> and renders localized strings (including HTML via MarkupString).

💡 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(HostModel): support en-US language

2 participants