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

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

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

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

Set Culture in an ASP.Net MVC app

I’m using this localization method and added a route parameter that sets the culture and language whenever a user visits example.com/xx-xx/ Example: routes.MapRoute(“DefaultLocalized”, “{language}-{culture}/{controller}/{action}/{id}”, new { controller = “Home”, action = “Index”, id = “”, language = “nl”, culture = “NL” }); I have a filter that does the actual culture/language setting: using System.Globalization; using … Read more