Skip to content

Set CurrentCulture to match UI language for locale-aware number formatting#286

Merged
mor39a merged 1 commit into
mainfrom
locale-aware-number-formatting
Mar 6, 2026
Merged

Set CurrentCulture to match UI language for locale-aware number formatting#286
mor39a merged 1 commit into
mainfrom
locale-aware-number-formatting

Conversation

@Kyome22
Copy link
Copy Markdown
Collaborator

@Kyome22 Kyome22 commented Mar 6, 2026

Context of Contribution

  • Bug Fix
  • Refactoring
  • New Feature
  • Others

Summary of the Proposal

Set CultureInfo.CurrentCulture at startup to match the current UI language, so that number formatting (decimal separator, etc.) follows the display language's conventions.

Reason for the new feature

Spanish localization was recently added, but Spanish uses a comma as the decimal separator (e.g. 85,3%, 1,5 GB) rather than a period. Previously, number formatting always followed the Windows system regional settings, independent of the app's UI language. This meant users running a Spanish UI on an English-configured system would still see period-separated numbers, which is incorrect.

.NET separates UI language (CurrentUICulture) from number/date formatting (CurrentCulture). By explicitly setting CurrentCulture to the culture that corresponds to the selected UI language, the app now behaves consistently — the same way iOS automatically ties number formatting to the active Locale.

This is a one-line change that reuses the existing SupportedLanguageExtension.GetDefaultCultureInfo() utility, with no modifications needed to ByteFormatter or the Repository classes.

Checklist

  • This PR does not contain commits of multiple contexts.
  • Code follows proper indentation and naming conventions.
  • Implemented using only APIs that can be submitted to the Microsoft Store.
  • Works correctly in both dark theme and light theme.
  • Works correctly on any device.

…tting

Spanish UI now shows comma as decimal separator (e.g. 85,3%, 1,5 GB),
while English and Japanese UI use period as before.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Kyome22 Kyome22 requested a review from mor39a March 6, 2026 07:57
Copy link
Copy Markdown
Collaborator

@mor39a mor39a left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mor39a mor39a merged commit ad9f69d into main Mar 6, 2026
@mor39a mor39a deleted the locale-aware-number-formatting branch March 6, 2026 11:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants