Bug: UI font size customization after switching from the default language
See original GitHub issueOne of the features I extremely like about this project is the possibility of customizing one’s look and feel as one pleases. However, I encountered a big bug, when playing around with it.
Bug Explained
When switching from the default language (English) to another language, German for example, and you try to change the default font size in the ThemesMenu
, the entire page bugs out, and one is unable to use the entire website, until he manually removes the userPreferences
cookie in their browser.
Besides the above, when switching from language, you can notice a small change in the entire website font size, without changing the values yet. All the text seems to become a little bit bigger than before.
Screenshot
I’ve tried to find the cause of this problem for a bit, but I’m completely lost in where to actually start digging. I hope you are able to find out what causes this issue and hope you are able to fix it!
Kind regards, Bram
Issue Analytics
- State:
- Created 3 months ago
- Comments:6
Top GitHub Comments
The problem arises when switching to a different language environment that uses a different decimal format due to cultural conventions. The objective is to ensure that the font size is consistently stored with a decimal point, even if the application’s language setting changes.
1) ThemesMenu.razor.cs In method ChangedFontSize(ChangeEventArgs args) Make this change:
UserPreferences.DefaultFontSize = double.Parse(args?.Value?.ToString() ?? "0", NumberStyles.Float, CultureInfo.InvariantCulture);
2) LayoutService.cs In methods ApplyUserPreferences(bool isDarkModeDefaultTheme) and UpdateUserPreferences(UserPreferences.UserPreferences preferences) Make this change:CurrentTheme.Typography.Default.FontSize = DefaultFontSize.ToString("0.0000", CultureInfo.InvariantCulture) + "rem";
Yeah, I changed my previous reply, because I indeed did not apply your suggestion properly in the first case, but it now works as intended! Thank you so much for your help!
You can find the final result here: #470