Skip to content

[iOS][globalization][NativeAOT] CultureInfo.CurrentCulture does not include region code #115302

Closed
@tipa

Description

@tipa

Description

CultureInfo.CurrentCulture.Name returns just "en", even if a non-English region is set in the iOS settings (such as "Germany")

Reproduction Steps

  • Specify iOS settings as can be seen in the screenshot below
  • create new iOS app (dotnet new ios) and set PublishAot=true in csproj
  • get iOS device ID using xcrun xctrace list devices
  • run dotnet publish -t:Run -p:_DeviceName=DEVICE_ID

Example project: ios_test.zip

Image

Expected behavior

CultureInfo.CurrentCulture.Name returns "en-DE"

Actual behavior

CultureInfo.CurrentCulture.Name returns "en"

Regression?

No response

Known Workarounds

I can construct my own, custom CultureInfo:
new CultureInfo(CultureInfo.CurrentCulture.TwoLetterISOLanguageName + "-" + NSLocale.CurrentLocale.RegionCode)

Configuration

.NET 9.0.4
iOS 18.4.1
iPhone SE

Other information

Perhaps related to #113614

CultureInfo.CurrentCulture.Name returns "en-DE" as expected when running in Debug mode (or in Release mode without using PublishAot=true) and also in a net9.0-macos app using these settings (Debug and Release mode):

Image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions