globalization

ASP.NET Globalization: Culture=“auto” page directive with neutral culture crash?

旧巷老猫 提交于 2019-12-09 17:17:57
问题 I'm running into a case where an ASP.NET application using the built-in globalization facilities is crashing. On an ASP.NET page with the Culture="auto" directive, a user with a neutral culture as their browser language (such as "zh-Hans") will produce the following exception: Culture 'zh-Hans' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture. at System.Globalization.CultureInfo.CheckNeutral(CultureInfo culture) at

C++ Win32 API equivalent of CultureInfo.TwoLetterISOLanguageName

雨燕双飞 提交于 2019-12-09 03:23:05
问题 The .NET framework makes it easy to get information about various locales; the Win32 C++ APIs are a bit harder to figure out. Is there an equivalent function in Win32 to get the two-letter ISO language name given an integer locale ID? In C# I'd do: System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo(1034); string iso = ci.TwoLetterISOLanguageName; // iso == "es" now. The code needs to run on XP and newer. 回答1: Thanks to Trevor for directing me toward this answer in an

VkKeyScan returning same code without modifiers for accented and unaccented letter

◇◆丶佛笑我妖孽 提交于 2019-12-08 19:39:28
Background: I am simulating keystrokes using the unmanaged function SendInput ( https://msdn.microsoft.com/en-us/library/windows/desktop/ms646310(v=vs.85).aspx ). There are 3 ways to call this function: Specify a keyboard scancode Specify a character unicode Specify a virtual key code All work, but to be able to simulate shortcuts such as CTRL+P I want to use the virtual key code. I currently have a manual mapping of character to virtual key code, but this is not a good approach as it is not sensitive to the user's OS keyboard layout. For example on an English (UK) keyboard the "." character

Why is my CurrentCulture en-GB and my CurrentUICulture en-US

北慕城南 提交于 2019-12-08 16:35:28
问题 I have a C# application which has to run on machines with different culture settings. No problem I thought, it will just lookup on start up what the current culture is on the machine, and do everything for me. Well no, it would seam that something is not quite right. I have a Windows XP machine with everything in Regional and Language options set to English US, yet when my application starts up it reports that my CurrentCulture is en-GB and my CurrentUICulture is en-US . How can I get my

CultureAndRegionInfoBuilder doesn't exist

耗尽温柔 提交于 2019-12-08 14:44:02
问题 Okay, this is a strange one. I'm trying to create a custom culture using: using System.Globalization; ... var x = new CultureAndRegionInfoBuilder(); But I get the nasty red Resharper error with no options. The type or namespace name 'CultureAndRegionInfoBuilder' does not exist in the namespace 'System.Globalization' What's going on, am I missing something? Can't find any help on google... 回答1: You need to add a reference to sysglobl.dll . This is already installed in the GAC as sysglobl . For

Switching language (cultureinfo/globalization) does not affect ToolStripMenuItems

霸气de小男生 提交于 2019-12-08 12:18:20
问题 I have a Windows Forms application project, and on the main form I have a menu strip. Some place in this menu strip it is possible to select various languages. For example if the user selects "English", everything on this main form (and others in the future) should be turned into English language. I took this tutorial: click This works fine with labels and such, but it does not work at all with the tool strip menu items. They just stay with their default text. I tried to add two more lines to

ASP date format using client culture code-behind

时光怂恿深爱的人放手 提交于 2019-12-08 07:37:53
问题 I have an ASP.NET web application and data in a SQLServer DB. What is the best way to display a date (extracted with LINQ) in the client's culture format, from code-behind. I mean I have users from USA and from Europe, they want different formats: MM/dd/yyyy (US) or dd/MM/yyyy (UK) ? What I would like is something like: from myData in dbContext.myFile Where .../... Select myFile.birthDate.ToString.(**some magic formating here**) Update: Thanks to Darin for quick answer! Tip: if using IE, don

Error messages from ModelState not get localized

寵の児 提交于 2019-12-08 07:33:17
问题 I am working on an application in mvc4.I want the application to work in English and Russian.I got titles in russian, but error messages are still in english. My model contains:- [Required(ErrorMessageResourceType = typeof(ValidationStrings), ErrorMessageResourceName = "CountryNameReq")] public string CountryName { get; set; } if(ModelState.IsValid) becomes false it will go to GetErrorMessage() public string GetErrorMessage() { CultureInfo ci = new CultureInfo(Session["uiCulture"].ToString())

MVC3 globalization issue

浪子不回头ぞ 提交于 2019-12-08 07:28:58
问题 I'm developing a MVC3 application with the next culture setup: <globalization enableClientBasedCulture="true" uiCulture="auto" culture="auto"/> First when I pass values from the view to the controller when I pass a integer all ok, but when I passed a double (3.2) the value in the controller was returned in 0 as was described in this question. Ok model binders added: protected void Application_Start() { AreaRegistration.RegisterAllAreas(); ModelBinders.Binders.Add(typeof(double), new

Xml Schemas and Date Times

末鹿安然 提交于 2019-12-08 06:54:19
问题 I'm beginning a new project which involves heavy xml and schema use accross multiple platforms (windows, windows mobile, Iphone, Ipad, and more which are yet to be discovered!). This xml platform has to be able to exchange date times from all over the world as our product is currently being implemented in Australia as well as in Canada and USA. Date times are generally the one "type" that causes the most issues between different platforms and languages. Should I trust the built in date type?