Closed martincostello closed 3 months ago
There are pieces of this story I don't understand so need to educate myself --
can we add cultures purely for string/number formatting (avoiding the significant cost of localizing more strings) and if so what if any is the cost - doesn't it simply pull from the OS locale database - indeed why would we not simply support any culture the OS has support for, why do we need to list them?
@mairaw @danzhu54 on the dotnet web site which I happened to compare, I see (LocaleDateConfiguration.cs) that you have hard-coded date formats for many cultures. Just curious why that isn't pulled from the OS locale database -- perhaps it's deployed in locale invariant mode somehow? I thought perhaps that relates to my question above.
There are pieces of this story I don't understand so need to educate myself --
- can we add cultures purely for string/number formatting (avoiding the significant cost of localizing more strings) and if so what if any is the cost - doesn't it simply pull from the OS locale database - indeed why would we not simply support any culture the OS has support for, why do we need to list them?
Yes. This is the difference between globalization and localization. Globalization is about how you represent numbers, dates etc where there are regional differences between how they are formatted. The .NET runtime should already have support for a large number of these, AFAIK we just need to enable it in blazor, which will take the locale preferences from the browser headers and then set the context for the page.
https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-8.0
- @mairaw @danzhu54 on the dotnet web site which I happened to compare, I see (LocaleDateConfiguration.cs) that you have hard-coded date formats for many cultures. Just curious why that isn't pulled from the OS locale database -- perhaps it's deployed in locale invariant mode somehow? I thought perhaps that relates to my question above.
There are pieces of this story I don't understand so need to educate myself --
- can we add cultures purely for string/number formatting (avoiding the significant cost of localizing more strings) and if so what if any is the cost - doesn't it simply pull from the OS locale database - indeed why would we not simply support any culture the OS has support for, why do we need to list them?
- @mairaw @danzhu54 on the dotnet web site which I happened to compare, I see (LocaleDateConfiguration.cs) that you have hard-coded date formats for many cultures. Just curious why that isn't pulled from the OS locale database -- perhaps it's deployed in locale invariant mode somehow? I thought perhaps that relates to my question above.
@danmoseley We created this custom hardcoded list of date configurations because during the time we implemented localization there wasn't a predefined date format that matched what we wanted to display. Perhaps there is one now but we haven't had the bandwidth to revist this.
There are pieces of this story I don't understand so need to educate myself --
- can we add cultures purely for string/number formatting (avoiding the significant cost of localizing more strings) and if so what if any is the cost - doesn't it simply pull from the OS locale database - indeed why would we not simply support any culture the OS has support for, why do we need to list them?
Yes. This is the difference between globalization and localization. Globalization is about how you represent numbers, dates etc where there are regional differences between how they are formatted. The .NET runtime should already have support for a large number of these, AFAIK we just need to enable it in blazor, which will take the locale preferences from the browser headers and then set the context for the page.
https://learn.microsoft.com/en-us/aspnet/core/blazor/globalization-localization?view=aspnetcore-8.0
- @mairaw @danzhu54 on the dotnet web site which I happened to compare, I see (LocaleDateConfiguration.cs) that you have hard-coded date formats for many cultures. Just curious why that isn't pulled from the OS locale database -- perhaps it's deployed in locale invariant mode somehow? I thought perhaps that relates to my question above.
Should we just do so then @samsp-msft? Enable support for all cultures beginning with the following (based on our localizations):
This is done now with #5143, right?
Is there an existing issue for this?
Is your feature request related to a problem? Please describe the problem.
After I opened #4882 it occurred to me that there are probably more cultures where the preferred formatting for dates is different to the neutral culture, as is the case with
en
anden-GB
.While supporting every case is probably overkill, there might be more values that are worth adding to the supported languages for the dashboard to respect the formatting defaults of more users of the Aspire dashboard in locations outside of the US, France, Spain etc.
Using the console application source below, on Windows 11 Version 22H2 (OS build 22621.3880) with in the UK with en-GB configured, I get the following list of cultures whose formatting for
DateTime.ToString()
differs from their parent culture (e.g. comparingen
againsten-GB
):Describe the solution you'd like
Additional cultures/languages for "popular" countries where developers may be using .NET Aspire are added to the supported languages for the Aspire dashboard to allow for their cultural preferences to be used in formatting operations.
Possible values to add from the long-list include:
en-AU
🇦🇺 Australiaen-CA
🇨🇦 Canadaen-GB
🇬🇧 United Kingdom (#4882)en-IE
🇮🇪 Irelanden-NZ
🇳🇿 New Zealandes-MX
🇲🇽 Mexicoes-US
🇺🇸 United Statesfr-CA
🇨🇦 Canadafr-CH
🇨🇭 Switzerlandit-CH
🇨🇭 Switzerland (the only Italian difference)tr-CY
🇨🇾 Cypress (the only Turkish difference)Additional context
No response