You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Regression: Norwegian localization no longer works in iOS with .NET 9 #112249
When having localized resources in your application, and one of them is norwegian no, the resource lookup no longer works and falls back to english. This behavior is only observed on net9.0-ios, and not on Windows and Android or in net8.0-ios.
Reproduction Steps
Open and run the following sample on iOS: MauiApp12.zip
Notice that the button says "Language is English". Repeat on Android and Windows or downgrade the iOS target to .NET 8 and notice the output is now correctly "Language is Norwegian".
Expected behavior
Norwegian resources are correctly looked up.
Actual behavior
Resources not found and falls back to the default english resource.
Regression?
Yes
Known Workarounds
No response
Configuration
.NET 9.0.101, ios-arm64 with iOS 18.2 as well as on iOS17.5
Other information
Looking at the generated NO culture this is what I'm seeing which is likely the cause of it:
var no = new System.Globalization.CultureInfo("no");
Debug.WriteLine(no.TwoLetterISOLanguageName); // return "nb" on net9.0-iOS, "no" on net9.0-Android and net8.0-ios
Debug.WriteLine(no.Name); // return "nb" on net9.0-iOS, "no" on net9.0-Android and net8.0-ios
Looks like in 8.0, dotnet linked its own fork of ICU into every ios app, and in 9.0, you use system libraries as much as possible instead: #80689
@dotMorten, as @steveisok said, it is being marked with 10.0.0 milestone just to annotate that we are actively working on it. Once the fix gets merged to main, we consider backporting it to the servicing releases depending on when/where the regression started occurring. Thank you for understanding.
As noted, in .NET 9 we use system libraries for globalization support on iOS platforms.
In case of no our code paths essentially end up calling:
NSLocale *currentLocale = [[NSLocalealloc] initWithLocaleIdentifier:@"no"];
constchar* value = [currentLocale.localeIdentifier UTF8String];
which returns nb.
The same behavior has been verified with plain Objective-C app in Xcode targeting MacOS and iOS platforms, which implies the behavior is imposed by Apple.
@tivik7 I'm building a 3rd party class library (so no language startup code), and the no language resources suddenly won't work because of this breaking behavior, but continues to work on all other platforms.
@dotMorten I guess you will be able to use complier directives to add the check for iOS in your library initialization code, or in the relevant features til this gets fixed. Not entirely sure how the CultureInfo.DefaultThreadCurrentCulture work, but believe that you set the culture for the entire app event if you set it from a library. Might be a need to set it using the main tread if not done in the initialization.
As noted, in .NET 9 we use system libraries for globalization support on iOS platforms.
In case of no our code paths essentially end up calling:
NSLocale currentLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"no"];
const char value = [currentLocale.localeIdentifier UTF8String];
which returns nb.
The same behavior has been verified with plain Objective-C app in Xcode targeting MacOS and iOS platforms, which implies the behavior is imposed by Apple.
Yes it makes it really hard to make cross-platform libraries that "just work". Changing the locale as suggested above is also problematic since that might cause problems with other libraries that are ios-specific and uses the other locale.
Activity
ivanpovazan commentedon Feb 6, 2025
/cc: @matouskozak
dotMorten commentedon Feb 7, 2025
@ivanpovazan Since this is a pretty big regression breaking localization, is there a reason it's pushed off to the next release?
steveisok commentedon Feb 9, 2025
We'll typically set the milestone for the next release as way to track active work. A separate backport decision is made when the change goes in.
ivanpovazan commentedon Feb 10, 2025
@dotMorten, as @steveisok said, it is being marked with 10.0.0 milestone just to annotate that we are actively working on it. Once the fix gets merged to main, we consider backporting it to the servicing releases depending on when/where the regression started occurring. Thank you for understanding.
ivanpovazan commentedon Feb 17, 2025
As noted, in .NET 9 we use system libraries for globalization support on iOS platforms.
In case of
noour code paths essentially end up calling:which returns
nb.The same behavior has been verified with plain Objective-C app in Xcode targeting MacOS and iOS platforms, which implies the behavior is imposed by Apple.
I opened a feedback ticket to apple: https://feedbackassistant.apple.com/feedback/16512787
In the meantime, @dotMorten is it feasible for you to add
nbresource as well to your app as a workaround?tivik7 commentedon Feb 21, 2025
@dotMorten
I am using in the startup to force the language setting, seems to be working
dotMorten commentedon Feb 21, 2025
@tivik7 I'm building a 3rd party class library (so no language startup code), and the
nolanguage resources suddenly won't work because of this breaking behavior, but continues to work on all other platforms.tivik7 commentedon Feb 23, 2025
@dotMorten I guess you will be able to use complier directives to add the check for iOS in your library initialization code, or in the relevant features til this gets fixed. Not entirely sure how the CultureInfo.DefaultThreadCurrentCulture work, but believe that you set the culture for the entire app event if you set it from a library. Might be a need to set it using the main tread if not done in the initialization.
matouskozak commentedon Aug 4, 2025
I'll keep this open to track this regression but move it to .NET 11 until https://feedbackassistant.apple.com/feedback/16512787 is addressed.
matouskozak commentedon Jul 13, 2026
This looks like intended behavior by Apple https://github.com/swiftlang/swift-corelibs-foundation/blob/ffb8de57a67e81b014c0e06296b273f1fcf3a1dc/Sources/CoreFoundation/CFLocaleIdentifier.c#L741-L746. Even though ICU treats "no" as a separate culture, Foundation
Localetreats it as "nb". We could special case "no" on the .NET side but from previous investigations it was just one of many culture which are treated differently by ObjectiveC APIs. @dotMorten is this still a blocking issue for your use-case?dotMorten commentedon Jul 14, 2026
Yes it makes it really hard to make cross-platform libraries that "just work". Changing the locale as suggested above is also problematic since that might cause problems with other libraries that are ios-specific and uses the other locale.
[Apple] Preserve Norwegian locale names in hybrid globalization (#130854