How format JavaScript Date with regard to the browser culture?

Browsers either use system settings for date formats, or use their own (often US–centric) settings. There is a Date.prototype.toLocaleDateString() method that should return a date based on current system settings, however it’s implementation dependent and completely unreliable due to being inconsistent between browsers. e.g. for me on 13 December, 2011: Safari returns 13 December 2001 … Read more

What is the difference between Culture and UICulture?

Culture affects how culture-dependent data (dates, currencies, numbers and so on) is presented. Here are a few examples: var date = new DateTime(2000, 1, 2); var number = 12345.6789; Thread.CurrentThread.CurrentCulture = new CultureInfo(“de-DE”); Console.WriteLine(date); // 02.01.2000 00:00:00 Console.WriteLine(number.ToString(“C”)); // 12.345,68 € Thread.CurrentThread.CurrentCulture = new CultureInfo(“fr-CA”); Console.WriteLine(date); // 2000-01-02 00:00:00 Console.WriteLine(number.ToString(“C”)); // 12 345,68 $ Thread.CurrentThread.CurrentCulture … Read more

How to change CurrentCulture at runtime?

Changing the current UI culture: System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo(“he-IL”); or better, retrieve a cached read-only instance of the he-IL culture: System.Threading.Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(“he-IL”); At run time, ASP.NET uses the resource file that is the best match for the setting of the CurrentUICulture property. The UI culture for the thread is set according to the UI … Read more

MVC 3 jQuery Validation/globalizing of number/decimal field

You could try the jQuery Globalization plugin from Microsoft: <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/jquery.validate.js”)” type=”text/javascript”></script> <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/jquery.validate.unobtrusive.js”)” type=”text/javascript”></script> <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/jquery.glob.js”)” type=”text/javascript”></script> <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/globinfo/jquery.glob.da-dk.js”)” type=”text/javascript”></script> <script type=”text/javascript”> $.validator.methods.number = function (value, element) { return !isNaN($.parseFloat(value)); } $(function () { $.preferCulture(‘da-DK’); }); </script> Plugin was renamed and moved, you should use Globalize (Mar 2012) <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/jquery.globalize/globalize.js”)” type=”text/javascript”></script> <script src=”https://stackoverflow.com/questions/5199835/@Url.Content(“~/Scripts/jquery.globalize/cultures/globalize.culture.da-DK.js”)” type=”text/javascript”></script> … Read more

How to getting browser current locale preference using javascript?

The following properties exist on the navigator object (which can also be known as clientInformation on IE but there’s no reason ever to use that name): language (non-IE, browser install language) browserLanguage (IE, browser install language) userLanguage (IE, user-level OS-wide language setting) systemLanguage (IE, OS installation language) But! You should never use any of these … Read more

What does MissingManifestResourceException mean and how to fix it?

All I needed to do to fix this problem was to right-click the Resources.resx file in the Solution Explorer and click Run Custom Tool. This re-generates the auto-generated Resources.Designer.cs file. If the .resx file was added to the project manually, the Custom Tool property of the file must be set to “ResXFileCodeGenerator”. The problem is … Read more