globalization

Detect decimal separator

╄→гoц情女王★ 提交于 2019-12-17 18:12:00
问题 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"; } } }

How to use NumberFormatInfo to remove parenthesis for negative values

只谈情不闲聊 提交于 2019-12-17 16:26:20
问题 We're currently using the following for creating US dollar values in our web application: string.Format("{0:C0}", dollarValue ); In this example, if dollarValue is 145, then we'll see: $145. If it is -145, then we'll see ($145) rather than -$145. Note that for us, dollarValue is a double, but it could be any number-type. I think. Anyway, what I want is for it to be either $145 or -$145. Now, according to my research, it might be possible to do this using the NumberFormatInfo class. I can't

.NET (3.5) formats times using dots instead of colons as TimeSeparator for it-IT culture?

冷暖自知 提交于 2019-12-17 07:55:13
问题 According to Wikipedia (and confirmed in an answer by Dario Solera), in Italy they format times using colons: The 24-hour notation is used in writing with a colon as a separator. Example: 14:05. The minutes are written with two digits; the hour numbers can be written with or without leading zero. However, running the following code seems to output dots: using System.Globalization; Thread.CurrentThread.CurrentCulture = new CultureInfo("it-IT"); Thread.CurrentThread.CurrentUICulture = new

.NET (3.5) formats times using dots instead of colons as TimeSeparator for it-IT culture?

旧街凉风 提交于 2019-12-17 07:54:15
问题 According to Wikipedia (and confirmed in an answer by Dario Solera), in Italy they format times using colons: The 24-hour notation is used in writing with a colon as a separator. Example: 14:05. The minutes are written with two digits; the hour numbers can be written with or without leading zero. However, running the following code seems to output dots: using System.Globalization; Thread.CurrentThread.CurrentCulture = new CultureInfo("it-IT"); Thread.CurrentThread.CurrentUICulture = new

DateTime.Parse not reversing month and day based on thread culture

依然范特西╮ 提交于 2019-12-14 03:29:18
问题 I'm parsing a date string from a database so that I can display it in the current culture of the UI thread. For some reason, the date is not parsing with respect to the culture - specifically, I'm parsing a en-US date to switch to a es-ES date and the month/day positions are not switching. According to this MSDN article I should just be able to use Parse with only the date string as a parameter. I should also be able to explicitly provide a culture object. Neither works and my date remains as

Localization of NaN in deDE returns “NaN” rather than “n. def.” in Windows 8/Server 2012

£可爱£侵袭症+ 提交于 2019-12-14 01:26:29
问题 Sometime between Windows 7 and Windows 8, Microsoft changed the localization of NaN in de-DE (aka German (Germany) ) from: n. def. to NaN Background There are people on Earth who speak a language other than English; and who speak English in a country other than the United States. As a result, different cultures have different ways to display a value that is "Not a number" . For example: English: NaN Arabic: ليس برقم Greek: μη αριθμός Alsatian: Ohne Nummer Basque: EdZ Breton: NkN Catalan: NeuN

Globalization and Localization in asp.net

ε祈祈猫儿з 提交于 2019-12-13 20:19:19
问题 We need to develop an ASP.NET 3.5 Web application, which should support Japanese and English languages. If the user is accessing from Japan, then our application should open in Japanese; otherwise, our application should open in English. How can we achieve this requirement? Sample code is very welcome. Thanks. 回答1: Your question is too broad and yet you expect a code sample. This is an architectural decision, first familiarize yourself with the ASP.NET Globalization mechanisms and then ask

Change keyboard layouts through code c#

余生颓废 提交于 2019-12-13 08:03:49
问题 i am developing a multi-lingual application allowing users to change language as well as keyboard layouts (through combobox). I am able to change the culture of application successfully but i'm unable to change the individual keyboard layouts e.g. for English (United States), im unable to change layouts from QWERTY (default) to Dvorak - Left hand etc.. Plz help me in this matter. Thanks alot Here's the code (e.g. for English language), the imports etc are added already.. CultureInfo

Are read-only CultureInfo objects thread-safe?

只愿长相守 提交于 2019-12-13 07:37:18
问题 Preface: I know how to create a read-only CultureInfo object. That is not the question and it has been answered in detail here: CultureInfo thread safety Note that the text of that question is similar to this one, but the answers are completely different. Before thinking about closing this question as a duplicate of the other one, please consider the fact that none of the answers in the other question answers this question. My question: Is it thread-safe to access instance members of a read

Determine regional business days and weekend days of the week

倖福魔咒の 提交于 2019-12-13 06:32:30
问题 In some countries weekend days are Friday/Saturday. How can a Windows application find out weekend days of the user? 回答1: Wellll...I don't know of a "One function" answer to this. You're gonna need to know where they are somehow. If it's a webapp, you can trace their IP and figure out what country they are from. If it's a windows app, you're probably going to need to ask them (The clock only provides timezone information, and i can't figure out where else to grab a more fine-grained location