Skip to content

doc(Html2Pdf): add localization for sample code#8080

Merged
ArgoZhang merged 1 commit into
mainfrom
doc-pdf
Jun 3, 2026
Merged

doc(Html2Pdf): add localization for sample code#8080
ArgoZhang merged 1 commit into
mainfrom
doc-pdf

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Jun 3, 2026

Link issues

fixes #8079

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

Documentation:

  • Add localized text for Html2Pdf common issues and configuration tips in the sample documentation.

Copilot AI review requested due to automatic review settings June 3, 2026 03:16
@bb-auto bb-auto Bot added the documentation Improvements or additions to documentation label Jun 3, 2026
@bb-auto bb-auto Bot added this to the v10.7.0 milestone Jun 3, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jun 3, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR localizes the Html2Pdf sample’s FAQ and PdfOptions documentation by replacing hard-coded Chinese text in the Razor component with Localizer-backed strings and adding the corresponding keys to the locale JSON files for en-US and zh-CN.

File-Level Changes

Change Details Files
Localize Html2Pdf sample FAQ and usage text in the Razor component.
  • Replaced hard-coded Chinese section title, FAQ questions, and answers with Localizer string lookups such as CommonIssuesTitle, Issue1Title, and Issue1Answer.
  • Wrapped HTML-containing localized values in MarkupString where needed to preserve formatting (e.g., Issue1Answer, Issue2Title, PdfOptionsIntro, and PdfOptionsItem* entries).
  • Localized the bullet list items explaining Issue 3 diagnostics and PdfOptions configuration options by using Localizer keys for each list item.
src/BootstrapBlazor.Server/Components/Samples/Html2Pdfs.razor
Add localization entries for the new Html2Pdf sample strings in both English and Chinese locale resources.
  • Introduced new keys for Html2Pdf FAQ titles, answers, and PdfOptions descriptions in the en-US locale file.
  • Added corresponding Chinese translations for the same keys in the zh-CN locale file, aligning keys with those referenced in Html2Pdfs.razor.
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json

Assessment against linked issues

Issue Objective Addressed Explanation
#8079 Add localization support to the Html2Pdf sample code documentation, replacing hard-coded text with localized resources and updating locale files as needed.

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

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

Adds localization support for the “Common issues” / troubleshooting sample text in the Html2Pdf demo page, moving previously hardcoded Chinese strings into the localization JSON resources.

Changes:

  • Localized the “Common issues” section titles, answers, and tips in Html2Pdfs.razor.
  • Added corresponding resource keys for the Html2Pdf sample to both en-US.json and zh-CN.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 zh-CN resource strings for Html2Pdf “Common issues” and PdfOptions tips.
src/BootstrapBlazor.Server/Locales/en-US.json Adds en-US resource strings for Html2Pdf “Common issues” and PdfOptions tips.
src/BootstrapBlazor.Server/Components/Samples/Html2Pdfs.razor Replaces hardcoded sample text with Localizer[...] lookups (using MarkupString where HTML is embedded).

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

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:

  • For the new localized strings, consider using a consistent pattern for MarkupString vs plain strings (e.g., only wrapping keys that actually contain HTML) to make the markup intent clearer and reduce unnecessary casting.
  • Double-check that all newly introduced localization keys (CommonIssuesTitle, Issue1Title, Issue1Answer, Issue2Title, Issue3*, Issue4*, PdfOptions*) are present and aligned in both en-US.json and zh-CN.json to avoid runtime missing-key issues.
  • Where you now reference Localizer[...] directly inside <p> and <li> elements, ensure the underlying resource text does not contain HTML; if it might, consider using MarkupString there too for consistency with other localized blocks.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- For the new localized strings, consider using a consistent pattern for `MarkupString` vs plain strings (e.g., only wrapping keys that actually contain HTML) to make the markup intent clearer and reduce unnecessary casting.
- Double-check that all newly introduced localization keys (CommonIssuesTitle, Issue1Title, Issue1Answer, Issue2Title, Issue3*, Issue4*, PdfOptions*) are present and aligned in both `en-US.json` and `zh-CN.json` to avoid runtime missing-key issues.
- Where you now reference `Localizer[...]` directly inside `<p>` and `<li>` elements, ensure the underlying resource text does not contain HTML; if it might, consider using `MarkupString` there too for consistency with other localized blocks.

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
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (e7d3b67) to head (02357fc).

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #8080   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          766       766           
  Lines        34171     34171           
  Branches      4700      4700           
=========================================
  Hits         34171     34171           
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.

@ArgoZhang ArgoZhang merged commit 525e75b into main Jun 3, 2026
7 checks passed
@ArgoZhang ArgoZhang deleted the doc-pdf branch June 3, 2026 03:34
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(Html2Pdf): add localization for sample code

2 participants