Open IeuanWalker opened 1 week ago
@IeuanWalker did you defined all supported languages in info.plist ? Refer to the documentation
@bhavanesh2001 I wasnt aware of that, must be something new in MAUI.
I have tried added -
<key>CFBundleLocalizations</key>
<array>
<string>cy</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
and
<key>CFBundleLocalizations</key>
<array>
<string>cy-GB</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
But still doesn't work
have a look at https://github.com/dotnet/runtime/issues/76596 maybe it is the same case for cy-GB - it is not in https://github.com/dotnet/icu/blob/dotnet/main/icu-filters/icudt_mobile.json
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @ivanpovazan, @steveisok, @akoeplinger See info in area-owners.md if you want to be subscribed.
Tagging subscribers to this area: @dotnet/area-system-globalization See info in area-owners.md if you want to be subscribed.
/cc: @matouskozak @mkhamoyan
@IeuanWalker The reason is likely the missing culture in the ICU we use for mobile as mentioned by @baaaaif. We try to make a trade-off between supporting full ICU and resulting app size on iOS, so we only included the most common culture names.
I just checked, and it works as expected with .NET 9 RC1. That is because, in .NET 9, we switched from using our own ICU to using the Apple ICU found on devices.
thanks @matouskozak, so in .NET 9 it should just work?
or would I still need to add this to the info.plist?
<key>CFBundleLocalizations</key>
<array>
<string>cy</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
thanks @matouskozak, so in .NET 9 it should just work?
or would I still need to add this to the info.plist?
CFBundleLocalizations cy CFBundleDevelopmentRegion en
Yes, the code that you sent
DateTime now = DateTime.Now;
Console.WriteLine("English: " + now.ToString("dddd, dd MMMM", new CultureInfo("en-GB")));
Console.WriteLine("Welsh: " + now.ToString("dddd, dd MMMM", new CultureInfo("cy-GB")));
should work as is.
I believe that https://learn.microsoft.com/en-us/dotnet/maui/fundamentals/localization?view=net-maui-8.0#ios-and-mac-catalyst is necessary if you plan to use localized resources.
Description
When the app launches the
SetCulture
method is called, set the apps culture to what the user has saved.This works completely fine on Android, but on iOS
StringFormat
in the xaml doesn't use the set culture, and stays as english -I've also tried doing the StringFormat in the model, and it also doesn't work -
Even setting the culture manually doesn't work -
It all worked fine in Xamarin.Forms, and it is a valid .NET Culture - https://dotnetfiddle.net/lyJP18
Steps to Reproduce
No response
Link to public reproduction project repository
No response
Version with bug
8.0.90 SR9
Is this a regression from previous behavior?
Yes, this used to work in Xamarin.Forms
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
No response
Did you find any workaround?
No, unless this is fixed, the only way I can see to work around it is to add a property to the API and perform the translation there.
Relevant log output
No response