-
-
Notifications
You must be signed in to change notification settings - Fork 235
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
Render currency symbol correctly in Boilerplate (#9752) #9753
Render currency symbol correctly in Boilerplate (#9752) #9753
Conversation
WalkthroughThe pull request introduces changes to how product prices are displayed and formatted across multiple components in the Boilerplate project. The modifications centralize price formatting logic within the Changes
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/Products/ProductDto.cs (1)
43-53
: Enhance price formatting robustness and documentation.The current implementation has room for improvement:
- Add XML documentation for maintainability.
- Handle negative and zero prices consistently.
- Preserve decimal precision in non-multilingual case.
Consider this enhanced implementation:
+ /// <summary> + /// Formats the price based on culture settings and multilingual support. + /// For RTL cultures, places the currency symbol after the amount. + /// For LTR cultures, uses the culture's default currency format. + /// </summary> + /// <returns>A formatted price string with appropriate currency symbol placement.</returns> private string FormatPrice() { if (CultureInfoManager.MultilingualEnabled) { return CultureInfo.CurrentCulture.TextInfo.IsRightToLeft - ? $"{Price:N0} {CultureInfo.CurrentCulture.NumberFormat.CurrencySymbol}" + ? $"{(Price >= 0 ? "" : "-")}{Math.Abs(Price):N2} {CultureInfo.CurrentCulture.NumberFormat.CurrencySymbol}" : Price.ToString("C"); } - return Price.ToString("N0"); + return Price.ToString("N2"); }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor
(2 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor.cs
(1 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/ProductPage.razor
(3 hunks)src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/Products/ProductDto.cs
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: build and test
🔇 Additional comments (4)
src/Templates/Boilerplate/Bit.Boilerplate/src/Shared/Dtos/Products/ProductDto.cs (1)
41-41
: LGTM! Clean property implementation.The read-only property with delegation to a private method follows good design practices.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor.cs (1)
5-7
: LGTM! Conditional compilation is correctly implemented.The module-specific imports are properly wrapped in conditional compilation directives.
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/ProductPage.razor (1)
24-24
: LGTM! Consistent price formatting across all product displays.The changes uniformly apply the new
FormattedPrice
property, ensuring consistent currency display throughout the page.Also applies to: 98-98, 144-144
src/Templates/Boilerplate/Bit.Boilerplate/src/Client/Boilerplate.Client.Core/Components/Pages/HomePage.razor (1)
38-38
: LGTM! Consistent price formatting across all product displays.The changes uniformly apply the new
FormattedPrice
property, ensuring consistent currency display throughout the page.Also applies to: 56-56
closes #9752
Summary by CodeRabbit
Release Notes
New Features
Improvements
ProductDto
Technical Updates
FormattedPrice
property