-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting No Names in regioninfo class on IOS #70028
Comments
From @rolfbjarne on Tue, 31 May 2022 13:09:07 GMT |
From @rolfbjarne on Tue, 31 May 2022 16:37:18 GMT Sample code: var regions = CultureInfo.GetCultures (CultureTypes.SpecificCultures)
.Select (culture => new RegionInfo (culture.Name))
.OrderBy (v => v.ThreeLetterISORegionName);
foreach (var r in regions) {
Console.WriteLine ($"{r.ThreeLetterISORegionName} {r.NativeName} {r.Name} {r.EnglishName} {r.DisplayName}");
} With iOS (both simulator and device) and Mac Catalyst, I get this:
on macOS, I get:
Looks like it could be a difference between Mono and CoreCLR, so I'm moving to dotnet/runtime. |
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
CC @steveisok |
IIRC It is a difference between how the ICU data are trimmed on mobile and desktop (where it comes from untrimmed system data, usually). It is possible to switch to a different ICU data file through |
Yeah, we trimmed a great deal with WASM initially and carried it forward into iOS. @rolfbjarne we could explore shipping an uncompressed data file that would need to be opted into. Thoughts? |
Tagging subscribers to this area: @dotnet/area-system-globalization Issue DetailsFrom @whann0205 on Tue, 31 May 2022 11:59:45 GMT Dont know if this is the correct place to report that question. Environment: Problem is clear to see i dont get any country names only the 3letter or 2letter code. Copied from original issue xamarin/xamarin-macios#15159
|
Tagging subscribers to 'os-ios': @steveisok, @akoeplinger Issue DetailsFrom @whann0205 on Tue, 31 May 2022 11:59:45 GMT Dont know if this is the correct place to report that question. Environment: Problem is clear to see i dont get any country names only the 3letter or 2letter code. Copied from original issue xamarin/xamarin-macios#15159
|
That's one option, which was to some extent discussed at dotnet/designs#225. Other option is augmenting with system data through the iOS APIs (likely NSLocale localizedStringForLocaleIdentifier in this case). |
@steveisok I marked this for future but feel free to move it back to .NET 7.0 as needed. |
Thanks for refreshing my memory on the design dock ;-). Hmm - augmenting with the iOS API's does not seem to be that big of a task. We talked about doing this early in .NET 7 and I like it better than opting into something. My team may be able to pick this up. |
Sorry to interrupt your "future" discussion, but may i ask what can i do now |
@whann0205 I think that a workaround for now would be to have your own map of culture identifiers to culture names and not rely on the built-in ones. Something like this: private static readonly IDictionary<string, string> CultureNameLookup = new()
{
{ "en-us", "English (US)" },
{ "de-de", "German" },
// ...
}; I know it isn't ideal, but you could generate this list from any working platform (e.g. .NET Core on Windows) and then paste the code into your app to run everywhere. Or, if your app only supports a limited set of cultures (say, less than 10), writing it manually should only take a few minutes. Would this work for your app until it's fixed in .NET? |
Thanks for you suggestion. |
I was hitting this problem today as well and that workaround isn't really satisfactory (at least for an iOS app) when you are supporting a lot of languages, because the I would appreciate if this could be fixed soon. |
Thanks for your interest. Now that 2 months have passed i tried again and it is sadly not In my case by using: You dont even get the localised Name but only the 2 letter iso code for the country in the field english See #70028 (comment) Have not found a way except writing here to get somebody to "pick that up". |
Anything happening here? Just ran into this today. |
It is still not fixed. Have not received any info that somebody working on it. |
We are planning on addressing this during the .net 8 timeframe. Most likely we'll call into the native api's as opposed to relying on our icu library exclusively. |
thanks steve. |
We'll look to see how straightforward this is to fix by itself and if it's easy, get something out. |
For what it's worth, I wrote a small tool that generates the culture data locally: https://gist.github.com/Eilon/ed9c7503b0a270fac2a94d4e0f2c42d9 You can run the tool to generated a new list, as well as show how to use an already-generated list I created on my machine. The output looks like this:
For anyone blocked by the limitation on some devices, you should be able to copy the culture data list from my sample code into your app, and then use LINQ to query whatever data you need. Hopefully this helps anyone who urgently needs this. |
@mkhamoyan when you have a chance, can you please see if hybrid globalization fixes this issue? |
hopefully this will be successfully shipped in .NET 8 |
Yes this will work on hybrid globalization mode. |
From @whann0205 on Tue, 31 May 2022 11:59:45 GMT
Dont know if this is the correct place to report that question.
If not please be so kind and direct me to the correct forum or
forward my issue to them.
Environment:
Win10
Visual Studio 2022 Preview lastest revision all updates installed
Net Maui lastest revision all updates installed
MacOS Monterrey on MacBook Air M1
Visual Studio 2022 Preview lastest revision all updates installed
Net Maui lastest revision all updates installed
Attached you find a screenshot what happens when i debug the application
on an android target (works ok)
and a screenshot from the same workstation targetting
the macbook´s simulator.
Have updated Xamarin IOS to the latest version
as was suggested by the macbooks´s visual studio
check for updates dialog.
Problem is clear to see i dont get any country names only the 3letter or 2letter code.
Copied from original issue xamarin/xamarin-macios#15159
The text was updated successfully, but these errors were encountered: