Skip to content

Conversation

@peereflits
Copy link
Collaborator

@peereflits peereflits commented Jan 16, 2026

Link issues

fixes #7530 as of discussion 7513

Summary

Added and translated xml documentation tags as of discussion 7513 for the ContentMenu types.

For the initial translation I used GitHub CoPilot (w Gpt-4.1) with this prompt:


Role: You are a technical writer in charge of the code documetation
Issue: the XML documetation tags are currently in Chinese simplified (culture code zh-Hans-CN)
Achievement: to be able to read the the XML documetation in Chinese and English
Expected Outcome: the XML documetation tags should have a paragraph in the original language (Chinese) and a paragraph with the text translated in English

Example

Current situation:

    /// <summary>
    /// 获得/设置 显示文本
    /// </summary>
    [Parameter]
    public string? Text { get; set; }

Expected outcome:

    /// <summary>
    ///  <para lang="zh">获得/设置 显示文本</para>
    ///  <para lang="en">The text to display.</para>
    /// </summary>
    [Parameter]
    public string? Text { get; set; }

Translate the active document.


(end of prompt)

Note:
In the documentation the usage of <inheritdoc> is invalid. I often see:

    /// <summary>
    /// <inheritdoc/>
    /// </summary>
    protected override void OnParametersSet() { ... }

while it should be:

    /// <inheritdoc/>
    protected override void OnParametersSet() { ... }

Regression?

  • Yes
  • No (no code changes)

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

Improve ContextMenu component documentation for bilingual readability and clarity without changing runtime behavior.

Documentation:

  • Add bilingual (Chinese and English) XML documentation for ContextMenu, ContextMenuItem, ContextMenuTrigger, ContextMenuZone, ContextMenuDivider, and IContextMenuItem types and members.
  • Clarify parameter and return value descriptions for context menu actions, including click handlers, touch delay, and registration methods.
  • Correct misuse of in lifecycle and disposable methods to follow recommended XML documentation patterns.
  • Document IContextMenuItem as a marker interface and provide usage-oriented descriptions for icon, disabled state, and related callbacks.

@bb-auto
Copy link

bb-auto bot commented Jan 16, 2026

Thanks for your PR, @peereflits. Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Jan 16, 2026

Reviewer's Guide

Adds bilingual (Chinese and English) XML documentation to ContextMenu-related components, fixes incorrect usage of , and slightly refines parameter/return descriptions, with one new using directive added to the IContextMenuItem interface file.

Class diagram for ContextMenu-related components with updated XML documentation

classDiagram
    class ContextMenu {
        +bool ShowShadow
        +Func<object, Task> OnBeforeShowCallback
        +RenderFragment ChildContent
        -List<IContextMenuItem> _contextMenuItems
        -ContextMenuZone ContextMenuZone
        -object _contextItem
        +Task Show(MouseEventArgs args, object contextItem)
        +void AddItem(IContextMenuItem item)
        +void RemoveItem(IContextMenuItem item)
        +override void OnInitialized()
        +override Task OnAfterRenderAsync(bool firstRender)
    }

    class ContextMenuItem {
        +string Text
        +string Icon
        +bool Disabled
        +Func<ContextMenuItem, object, bool> OnDisabledCallback
        +Func<ContextMenuItem, object, Task> OnClick
        -ContextMenu ContextMenu
        -bool disposedValue
        +override void OnInitialized()
        +void Dispose(bool disposing)
        +void Dispose()
    }

    class ContextMenuDivider {
        -ContextMenu ContextMenu
        -bool disposedValue
        +override void OnInitialized()
        +override void BuildRenderTree(RenderTreeBuilder builder)
        +void Dispose(bool disposing)
        +void Dispose()
    }

    class ContextMenuTrigger {
        +RenderFragment ChildContent
        +string WrapperTag
        +object ContextItem
        -ContextMenuZone ContextMenuZone
        +int? OnTouchDelay
        +bool IsTouchStarted
        -bool IsBusy
        -CssBuilder ClassBuilder
        +override void OnParametersSet()
        +override void BuildRenderTree(RenderTreeBuilder builder)
        +Task OnContextMenu(MouseEventArgs args)
    }

    class ContextMenuZone {
        +RenderFragment ChildContent
        -CssBuilder ClassBuilder
        -ContextMenu _contextMenu
        +Task OnContextMenu(MouseEventArgs args, object contextItem)
        +void RegisterContextMenu(ContextMenu contextMenu)
    }

    class IContextMenuItem {
    }

    class ComponentBase
    class BootstrapComponentBase
    class Divider
    class RenderTreeBuilder
    class RenderFragment
    class MouseEventArgs

    ContextMenuItem ..|> IContextMenuItem
    ContextMenuItem --|> ComponentBase
    ContextMenuItem ..|> IDisposable

    ContextMenuDivider ..|> IContextMenuItem
    ContextMenuDivider --|> Divider
    ContextMenuDivider ..|> IDisposable

    ContextMenuTrigger --|> BootstrapComponentBase

    ContextMenuZone o-- ContextMenu
    ContextMenuTrigger o-- ContextMenuZone
    ContextMenu "1" o-- "*" IContextMenuItem
    ContextMenuItem o-- ContextMenu
    ContextMenuDivider o-- ContextMenu
Loading

File-Level Changes

Change Details Files
Add bilingual XML documentation (Chinese + English) to ContextMenu component API, including parameters and return values.
  • Convert single-language XML summaries to and blocks for the ContextMenu component.
  • Document the Show method parameters and return value with bilingual descriptions and appropriate type references.
  • Document AddItem and RemoveItem with bilingual parameter descriptions referring to IContextMenuItem.
src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs
Improve XML documentation for ContextMenuItem component, including properties, callbacks, and disposal semantics.
  • Add bilingual summaries to ContextMenuItem class and its public parameters (Text, Icon, Disabled, OnDisabledCallback, OnClick).
  • Add an block for the Icon property showing typical CSS class usage.
  • Add bilingual documentation for the Dispose(bool) method parameter and clarify resource-release behavior.
  • Clean up invalid placement by removing redundant wrappers.
src/BootstrapBlazor/Components/ContextMenu/ContextMenuItem.cs
Align ContextMenuTrigger documentation with ContextMenu, including trigger behavior and touch-delay semantics, and fix inheritdoc placement.
  • Replace Chinese-only summaries with bilingual and descriptions for ContextMenuTrigger, WrapperTag, ContextItem, OnTouchDelay, IsTouchStarted, and IsBusy.
  • Use for ChildContent to share documentation with ContextMenu.
  • Remove redundant XML wrappers around for OnParametersSet and BuildRenderTree.
src/BootstrapBlazor/Components/ContextMenu/ContextMenuTrigger.cs
Document ContextMenuZone behavior and its interaction with triggers and context menus using bilingual XML comments.
  • Add bilingual documentation for ContextMenuZone class and its ChildContent parameter via .
  • Document OnContextMenu with bilingual descriptions for parameters and return Task.
  • Document RegisterContextMenu with bilingual descriptions for the contextMenu parameter and its purpose.
src/BootstrapBlazor/Components/ContextMenu/ContextMenuZone.razor.cs
Document ContextMenuDivider behavior and disposal semantics with bilingual comments and fix inheritdoc usage.
  • Add bilingual XML documentation to ContextMenuDivider class explaining its role as a divider menu item.
  • Document Dispose(bool) with bilingual parameter description explaining managed resource release.
  • Remove redundant wrappers around for lifecycle methods.
src/BootstrapBlazor/Components/ContextMenu/ContextMenuDivider.cs
Add bilingual documentation and a remark to IContextMenuItem clarifying its role as a marker interface, and introduce a new using directive.
  • Replace single-language summary on IContextMenuItem with bilingual and text.
  • Add a section noting that this is a marker interface with a reference link.
  • Introduce a new using static System.Net.WebRequestMethods; directive, which appears unused and may be accidental.
src/BootstrapBlazor/Components/ContextMenu/IContextMenuItem.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7530 Add English XML documentation to ContextMenu-related types and members so that non-Chinese-speaking developers can understand the code.
#7530 Preserve the original Chinese XML documentation while restructuring comments to include both Chinese and English using language-specific elements (e.g., and ).

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

@bb-auto bb-auto bot added the documentation Improvements or additions to documentation label Jan 16, 2026
@bb-auto bb-auto bot added this to the v10.2.0 milestone Jan 16, 2026
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:

  • The new using static System.Net.WebRequestMethods; in IContextMenuItem.cs appears unused and should be removed to avoid unnecessary dependencies.
  • For the Icon property example, consider wrapping the sample value in a <code> block or showing it in a typical component usage snippet (e.g., <ContextMenuItem Icon="fa-solid fa-bookmark" />) to make the documentation clearer.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `using static System.Net.WebRequestMethods;` in `IContextMenuItem.cs` appears unused and should be removed to avoid unnecessary dependencies.
- For the `Icon` property example, consider wrapping the sample value in a `<code>` block or showing it in a typical component usage snippet (e.g., `<ContextMenuItem Icon="fa-solid fa-bookmark" />`) to make the documentation 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.

@codecov
Copy link

codecov bot commented Jan 16, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7532   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          748       748           
  Lines        32998     32998           
  Branches      4588      4588           
=========================================
  Hits         32998     32998           
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 bilingual XML documentation to the ContextMenu component types, translating Chinese documentation into English while preserving the original Chinese text. This addresses issue #7530 and improves code documentation accessibility for non-Chinese readers.

Changes:

  • Added bilingual XML documentation tags with <para lang="zh"> and <para lang="en"> to all ContextMenu-related classes
  • Corrected improper <inheritdoc/> usage by removing redundant <summary> wrappers
  • Enhanced parameter and return value documentation with language-specific descriptions

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
IContextMenuItem.cs Added bilingual documentation and remarks; introduced unused import
ContextMenuZone.razor.cs Translated component, method, and parameter documentation to English
ContextMenuTrigger.cs Added bilingual documentation and corrected <inheritdoc/> usage
ContextMenuItem.cs Translated property and method documentation; added icon usage example
ContextMenuDivider.cs Added bilingual documentation and corrected <inheritdoc/> usage
ContextMenu.razor.cs Comprehensive bilingual documentation for all public members

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

@ArgoZhang ArgoZhang changed the title doc(ContextMenu): Make code documentation readable for non-Chinese readers doc(Component): comments support both Chinese and English Jan 16, 2026
@ArgoZhang ArgoZhang merged commit da441c3 into main Jan 16, 2026
6 checks passed
@ArgoZhang ArgoZhang deleted the issue-7530 branch January 16, 2026 12:41
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(Component): Make code documentation readable for non-Chinese readers

3 participants