Skip to content

[iOS] Respect user numeric format overrides#130510

Draft
matouskozak wants to merge 1 commit into
dotnet:mainfrom
matouskozak:matouskozak-investigate-ios-numeric-format
Draft

[iOS] Respect user numeric format overrides#130510
matouskozak wants to merge 1 commit into
dotnet:mainfrom
matouskozak:matouskozak-investigate-ios-numeric-format

Conversation

@matouskozak

Copy link
Copy Markdown
Member

Fixes #110430

Summary

  • create dedicated user-default culture data for Apple Hybrid Globalization
  • use NSLocale.currentLocale for overrideable locale values while keeping named cultures identifier-based
  • add Apple mobile regression coverage for current and named culture number formats
  • preserve PredefinedCulturesOnly validation for the user-default locale

Testing

  • ./build.sh mono+libs -os iossimulator -arch arm64
  • CurrentCultureTests on the iOS simulator: 9 passed, 0 failed
  • Runtime iOS sample: decimal.TryParse("1,23") changed from 123 to 1.23 with the device override

Note

This pull request description was generated with GitHub Copilot.

Use the current NSLocale for overrideable data on the Apple Hybrid user-default culture while keeping explicitly named cultures identifier-based.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates Apple Hybrid Globalization so the user-default culture can reflect iOS “Numeric Format” overrides (e.g., decimal/group separators) by switching relevant native locale lookups to use NSLocale.currentLocale when user overrides are enabled.

Changes:

  • Plumbs a useUserOverride flag through Apple-hybrid native locale info entrypoints and corresponding managed LibraryImport declarations.
  • Creates a dedicated “user default” CultureData path on Apple mobile Hybrid mode and uses it to construct CultureInfo.CurrentCulture.
  • Adds Apple mobile regression tests asserting current vs named culture number format behavior.

Reviewed changes

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

Show a summary per file
File Description
src/native/libs/System.Globalization.Native/pal_localeStringData.h Adds useUserOverride parameter to Apple-hybrid string locale info export.
src/native/libs/System.Globalization.Native/pal_localeNumberData.h Adds useUserOverride parameter to Apple-hybrid numeric/grouping locale info exports.
src/native/libs/System.Globalization.Native/pal_locale.m Introduces GetNativeLocale helper using currentLocale when overrides are requested; threads the flag through native exports.
src/libraries/Common/src/Interop/Interop.Locale.iOS.cs Updates managed LibraryImport signatures to include useUserOverride (marshalled as UnmanagedType.Bool).
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureInfo.Unix.cs Uses a new Apple-hybrid user-default CultureData creation path for CurrentCulture.
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.iOS.cs Adds GetUserDefaultCultureData and threads useUserOverride to native locale info calls.
src/libraries/System.Private.CoreLib/src/System/Globalization/CultureData.cs Ensures Apple-hybrid “user override” locale queries consult _bUseOverrides when calling into native.
src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoCurrentCulture.cs Adds Apple mobile tests for current vs named culture number separators.

Comment thread src/native/libs/System.Globalization.Native/pal_locale.m
@matouskozak matouskozak added the os-ios Apple iOS label Jul 10, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS Numeric Format setting not respected

3 participants