Skip to content
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

Resolve Font Size Adjustment Discrepancy Across Cultures #470

Merged
merged 4 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CleanArchitecture.Blazor.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>CleanArchitecture.Blazor.Solution.Template</id>
<version>1.0.0-preview.9</version>
<version>1.0.0-preview.10</version>
<title>Clean Architecture Blazor Solution Template</title>
<authors>hl.z</authors>
<description>Clean Architecture Blazor Solution Template for .NET 7.</description>
<summary>
A Clean Architecture Blazor Server Solution Template for creating a Single-Page Application (SPA) with ASP.NET Core.
</summary>
<releaseNotes>
1.0.0-preview.10
- Resolved font size adjustment discrepancy across cultures
1.0.0-preview.9
- 🍒 Improve Specification Query
</releaseNotes>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Globalization;
using Blazor.Server.UI.Services;
using Blazor.Server.UI.Services.Layout;
using Blazor.Server.UI.Services.UserPreferences;
Expand Down Expand Up @@ -76,8 +77,7 @@ public async Task ToggleDarkLightMode(DarkLightMode mode )
}
private async Task ChangedFontSize(ChangeEventArgs args)
{
UserPreferences.DefaultFontSize = double.Parse(args?.Value?.ToString() ?? "0");
UserPreferences.DefaultFontSize = double.Parse(args?.Value?.ToString() ?? "0", NumberStyles.Float, CultureInfo.InvariantCulture);
await UserPreferencesChanged.InvokeAsync(UserPreferences);
}

}
5 changes: 3 additions & 2 deletions src/Blazor.Server.UI/Services/Layout/LayoutService.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Globalization;
using Blazor.Server.UI.Services.UserPreferences;

namespace Blazor.Server.UI.Services.Layout;
Expand Down Expand Up @@ -49,7 +50,7 @@ public void SetDarkMode(bool value)
CurrentTheme.Palette.Secondary = SecondaryColor;
CurrentTheme.PaletteDark.Secondary = SecondaryColor;
CurrentTheme.LayoutProperties.DefaultBorderRadius = BorderRadius + "px";
CurrentTheme.Typography.Default.FontSize = DefaultFontSize + "rem";
CurrentTheme.Typography.Default.FontSize = DefaultFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem";
}
else
{
Expand Down Expand Up @@ -170,7 +171,7 @@ public async Task UpdateUserPreferences(UserPreferences.UserPreferences preferen
CurrentTheme.Palette.Secondary = SecondaryColor;
CurrentTheme.PaletteDark.Secondary = SecondaryColor;
CurrentTheme.LayoutProperties.DefaultBorderRadius = BorderRadius + "px";
CurrentTheme.Typography.Default.FontSize = DefaultFontSize+"rem";
CurrentTheme.Typography.Default.FontSize = DefaultFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem";
await _userPreferencesService.SaveUserPreferences(_userPreferences);
OnMajorUpdateOccured();
}
Expand Down