I don't think this has ever been asked on StackOverflow. I'm writing a C# program, but this question applies to any programming language under Windows 7.
Since I want to make my program compatible with as many countries as possible (but with limited time at hand), what are the top 10 most common locales to test for? Since I'm using C#, this can be found by using:
CultureInfo.CurrentCulture.ToString()
As far as I know, these correspond with the items under: Control Panel -> Region and Language -> Format
A no-brainer to test for would be "English - (United States)" (which under C# is "en-US"). That's just one though - I'm looking for another 5-10 or so.
The top 10 should also include 'variety'. For example, if they all used the period as the decimal point, that wouldn't be very helpful. I'd also want at least one to use the comma as the decimal point (as Europe, South America, Russia, and others do).
Likewise, I'd want locales which use the '.', '/' and '-' as the date separator.
So my original question is now a bit more complex, but potentially much more useful. I want the most used locales, but with a slight to moderate bias towards variety so that I can generalize testing more easily with a much better guarantee that they will work under untested locales.
A locale can be composed of both a base language, the country (territory) of use, and possibly codeset (which is usually assumed). For example, German is de, an abbreviation for Deutsch, while Swiss German is de_CH, CH being an abbreviation for Confederation Helvetica.
After an hour's search, the best I could come up with was a few links supplying a 'top 10' based on their own feedback. In an effort to help other users, I've combined the results to produce this probably moderately to wildly inaccurate top 12 list:
C# code URL pos Windows region format Short date Long time xyz
en-US 1,1,1 English (United States) M/D/yyyy h:mm:ss tt .,,
zh-CN 2,2,20 Chinese (simplified, PRC) yyyy/M/d H:mm:ss .,,
ru-RU 4,10,5 Russian (Russia) dd.MM.yyyy H:mm:ss , ;
fr-FR 8,5,7 French (France) dd/MM/yyyy HH:mm:ss , ;
es-ES 5,9,10 Spanish (Spain) dd/MM/yyyy H:mm:ss ,.;
en-GB 11,7,2 English (United Kingdom) dd/MM/yyyy HH:mm:ss .,,
de-DE 12,3,3 German (Germany) dd.MM.yyyy HH:mm:ss ,.;
pt-BR 10,6,10 Portuguese (Brazil) dd/MM/yyyy HH:mm:ss ,.;
en-CA 14,8,12 English (Canada) dd/MM/yyyy h:mm:ss tt .,,
es-MX 13,13,13 Spanish (Mexico) dd/MM/yyyy hh:mm:ss tt .,,
it-IT 16,6,- Italian (Italy) dd/MM/yyyy HH:mm:ss ,.;
ja-JP 15,8,30 Japanese (Japan) yyyy/MM/dd H:mm:ss .,,
x = Decimal symbol. y = Digit grouping symbol. z = List separator. The three numbers in the URL rating represent how far up in each list the locale was.
Sources:
One can use this URL to convert between region and the C# code: http://www.csharp-examples.net/culture-names/
Below is the final filtered list I personally will be checking for. I've removed cultures which are similar or nearly similar to other cultures (mainly in terms of dates, times, and symbols/separators;- if your criteria is something else, I would pay more attention to the above list). I've also added Bengali (India) and Danish (Denmark) which are quite different to the others.
C# code URL pos Windows region format Short date Long time xyz
en-US 1,1,1 English (United States) M/D/yyyy h:mm:ss tt .,,
de-DE 12,3,3 German (Germany) dd.MM.yyyy HH:mm:ss ,.;
fr-FR 8,5,7 French (France) dd/MM/yyyy HH:mm:ss , ;
zh-CN 2,2,20 Chinese (simplified, PRC) yyyy/M/d H:mm:ss .,,
es-ES 5,9,10 Spanish (Spain) dd/MM/yyyy H:mm:ss ,.;
ru-RU 4,10,5 Russian (Russia) dd.MM.yyyy H:mm:ss , ;
en-GB 11,7,2 English (United Kingdom) dd/MM/yyyy HH:mm:ss .,,
bn-IN -,-,- Bengali (India) dd-MM-yy HH.mm.ss .,,
da-DK -,-,- Danish (Denmark) dd-MM-yyyy HH:mm:ss ,.;
x = Decimal symbol. y = Digit grouping symbol. z = List separator
One tricky aspect to globalization is handling right-to-left (RTL) languages. So I would include a locale that uses Arabic (or Hebrew) in your list, such as ar-EG
"Arabic (Egypt)".
You could also take the pseudo-locale approach and test using the .NET-supported pseudo-locales, which exhibit peculiarities that can expose globalization bugs. There are three of them, "Base" (which is convenient as it produces intelligible text such as "[Шěđлеśđαỳ !!!], 8 ōf [Μäŕςћ !!] ōf 2006"), "Mirrored" and "East Asian-language".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With