globalization

Detect decimal separator

Deadly 提交于 2019-11-28 07:11:21
I have to detect decimal separator in current windows setting. Im using visual studio 2010, windows form. In particular, if DecimalSeparator is comma, if user input dot in textbox1, I need show zero in textbox2. I tryed with this code, but not works: private void tbxDaConvertire_KeyPress(object sender, KeyPressEventArgs e) { string uiSep = CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalSeparator; if (uiSep.Equals(",")) { while (e.KeyChar == (char)46) { tbxConvertito.Text = "0"; } } } I have tryed also this code, but not work: private void tbxDaConvertire_KeyPress(object sender,

How to parse string to decimal with currency symbol?

ぃ、小莉子 提交于 2019-11-28 07:02:51
问题 I have no idea why this is not working: string s = "12,00 €"; var germanCulture = CultureInfo.CreateSpecificCulture("de-DE"); decimal d; if (decimal.TryParse(s, NumberStyles.AllowCurrencySymbol, germanCulture, out d)) { // i want to get to this point Console.WriteLine("Decimal value: {0}", d); } 回答1: Use NumberStyles.Currency instead of NumberStyles.AllowCurrencySymbol if (decimal.TryParse(s, NumberStyles.Currency, germanCulture, out d)) and the output for you code would be: Decimal value: 12

Language Bar change language in c# .NET

岁酱吖の 提交于 2019-11-28 06:44:59
问题 TL;DR : Trying to solve the issue that InputLanguage changes the input layout but does not update the Language Bar display. I am writing a custom plugin for Trados Studio. Part of this is interfacing with languages both in the app itself and in Word, as in this question: List of all available languages for Windows .NET framework The last problem I seem to cannot solve is that in a part of the code I am using InputLanguage to set the keyboard input to en-US. To clarify, there is a limited API,

how to set default culture info for entire c# application

冷暖自知 提交于 2019-11-28 05:40:33
I want to set default culture info for that class or for entire application. For example in Turkey 3,2 = in english 3.2 so application uses my local but i want it to use as default System.Globalization.CultureInfo.InvariantCulture How can i set it to that as default for that specific class or for entire application Alexei Levenkov Not for entire application or particular class. CurrentUICulture and CurrentCulture are settable per thread as discussed here Is there a way of setting culture for a whole application? All current threads and new threads? . You can't change InvariantCulture at all.

Why do I get, “Culture is not supported” and What, if Anything, Should I Do about it?

别等时光非礼了梦想. 提交于 2019-11-28 02:51:57
问题 I have a breakpoint on the "return" line here: [HttpGet] [Route("api/Test/{id1}/{id2}")] public NRBQEntity GetTestMessage(String id1, String id2) { return NRBQClient.GetTestMessage(id1, id2); } Although it does not crash the app, when I reach that point, I get, " Exception:Thrown: "Culture is not supported." (System.Globalization.CultureNotFoundException) A System.Globalization.CultureNotFoundException was thrown: "Culture is not supported." " Which culture is trying to be supported, why is

Javascript Date Localization

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 23:56:02
问题 I'm working with an ASP.NET app with localization and globalization. I'm having some difficulty understanding how to get the Date() function in javascript to work properly given the user's environment. My user base is split between Mexico (spanish) and the US (english). Since the Mexico date format is dd/mm/yyyy and the english format is mm/dd/yyyy, the standard Date(strDate) javascript constructor does not work for me. Does anyone know the best way to handle globalization/localization of a

CultureInfo & DateTimeInfo: How to check if is 24 hour time?

六眼飞鱼酱① 提交于 2019-11-27 22:14:25
问题 I'm modifying a globalized web application which uses stored CultureInfo for each logged in user. The client would like time data entry to be localized. Displaying is not a problem as the formatting is already available. However I need to detect if the current cultureinfo is for 24 hour time or am/pm so I can display the correct input boxes (not just a textfield). My initial idea was to check the DateTimeInfo property of CultureInfo and see if the ShortTimePattern contained a capital H or a

Get current language in CultureInfo

泪湿孤枕 提交于 2019-11-27 21:47:32
How to identify the operating system's language using CultureInfo ? E.g. if the language in Windows is set to French, I need to identify French and load the fr resource files data. I think something like this would give you the current CultureInfo: CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture; Is that what you're looking for? This is what i used: var culture = System.Globalization.CultureInfo.CurrentCulture; and it's working :) Current system language is retrieved using : CultureInfo.InstalledUICulture "Gets the CultureInfo that represents the culture installed with the

CurrentCulture incorrectly defaulting to en-US in ASP.net

北城以北 提交于 2019-11-27 20:29:28
问题 I have just migrated around 100 ASP.net sites from IIS 6 on Windows Sever 2003 to IIS 7 on Windows 2008. I've just noticed that various pieces of code that use things like DateTime.Parse have started kicking up errors "String was not recognized as a valid DateTime". I've tracked this down to the fact that the CurrentCulture of the sites is defaulting to 'en-US' and so my UK users are inputting dates in an unexpected format. Question is, where are they getting en-US from? Starting from the top

What cultures are supported by the CultureInfo class in .NET 3.5?

回眸只為那壹抹淺笑 提交于 2019-11-27 19:29:16
问题 I need a list of cultures that are supported by .NET 3.5, regardless of the OS used. This seems to be quite a struggle to obtain, though I am not sure why! Edit: Arghh, I was not aware that it is dependent on the OS, that would explain the lack of documentation. Any ideas on what is supported by Mac/Linux OS as well? Thanks :) 回答1: Unfortunately, it is OS dependent. Check here for default language support per OS. Note, the CultureInfo documentation warns: Windows versions or service packs can