Open tipa opened 3 weeks ago
Tagging subscribers to this area: @dotnet/area-system-globalization See info in area-owners.md if you want to be subscribed.
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @ivanpovazan, @steveisok, @akoeplinger See info in area-owners.md if you want to be subscribed.
cc @matouskozak
@tipa what culture is your application using?
I see the correct output after setting the culture to en-US
.
@matouskozak I see these results:
CultureInfo.CurrentCulture.NumberFormat.CurrencySymbol -> ¤
CultureInfo.CurrentCulture.Name -> "en"
new CultureInfo("en-US").NumberFormat.CurrencySymbol -> $
new CultureInfo("de-DE").NumberFormat.CurrencySymbol -> €
new CultureInfo("en").NumberFormat.CurrencySymbol -> ¤
Is this the expected behaviour?
I think en
is a "neutral" culture code. You can set the specific culture (en-US
) using https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo.defaultthreadcurrentculture?view=net-9.0 and it should work as expected.
I don't (want to) set the current culture myself - and I don't know the users culture (region). My use-case was to show a default currency symbol in my app, that the user could edit. Previously (.NET 8, even with HybridGlobalization=true
) my code returned a $
for US users, probably because CultureInfo.CurrentCulture
did not return a neutral culture. If this was an expected change, then that's ok and we can close this issue :) I have my workaround with NSLocale.CurrentLocale.CurrencySymbol
anyways
I don't (want to) set the current culture myself - and I don't know the users culture (region). My use-case was to show a default currency symbol in my app, that the user could edit. Previously (.NET 8, even with
HybridGlobalization=true
) my code returned a$
for US users, probably becauseCultureInfo.CurrentCulture
did not return a neutral culture. If this was an expected change, then that's ok and we can close this issue :) I have my workaround withNSLocale.CurrentLocale.CurrencySymbol
anyways
I think it is not expected change, and we should investigate.
Description
With .NET 9, the current currency symbol / currency code are not available any more / replaced by the generic currency symbol
Reproduction Steps
dotnet new ios
Expected behavior
Actual behavior
Regression?
Yes, it worked in .NET 8, even with
HybridGlobalization=true
Known Workarounds
I can just use the iOS methods
NSLocale.CurrentLocale.CurrencySymbol
orNSLocale.CurrentLocale.CurrencyCode
Configuration
.NET 9 RC2 iPhone SE 2 (system language German)
Other information
No response