cultureinfo

Installing more cultures on Windows Server 2012

江枫思渺然 提交于 2020-01-13 03:37:08
问题 On a Windows 8.1 machine, I'm seeing many more available cultures than on a Windows Server 2012 machine: 791 vs 378. To give a specific example, the server machine is missing the 'en-HK' culture. Here is the test code I'm using to enumerate them: foreach (var ci in CultureInfo.GetCultures(System.Globalization.CultureTypes.AllCultures).OrderBy(ci => ci.Name)) { Console.WriteLine("{0} ({1})", ci.Name, ci.EnglishName); } Question: how can I install the more complete culture list on Windows

How to make DateTime independent from the current culture?

浪尽此生 提交于 2020-01-13 01:30:13
问题 I cam trying to convert a datetime to string and back, but making it so that it works for all cultures. I basically have a Textbox (tbDateTime) and a label (lbDateTime). The label tells the user, in which format the software expects the input of tbDateTime. The input of the Textbox will be used for an MySQL command. Currently it works like this: lbDateTime.Text = "DD.MM.YYYY hh:mm:ss"; // I live in germany DateTime date = Convert.ToDateTime(tbDateTime.Text); String filter = date.ToString(

CultureInfo and Double.parse and double.toString not worked correctly

为君一笑 提交于 2020-01-07 04:20:28
问题 How can I force c# application to use . for decimal separator and ignore culture settings in server. I have this problem with double.ToString and double.parse I should change setting in application level because of large scale of application. exception occurse in case like double.parse("1/25") and 1.25 ToString I have Try This code string CultureName = Thread.CurrentThread.CurrentCulture.Name; CultureInfo ci = new CultureInfo(CultureName); if (ci.NumberFormat.NumberDecimalSeparator != ".") {

Get week number for the given date c#

本秂侑毒 提交于 2020-01-06 12:47:07
问题 I have tried searching for a solution which gives the correct week number for the date value. link1, link2,link3 Followed the methods in the above links, but for the date 30/12/2014, I get the week number as 53. but it falls as 1st week of 2015 year. I tried the below methods to get the week number of the year for the specific date. private int GetWeekNumberOfTheYear() { var currentCulture = CultureInfo.CurrentCulture; // option 1 var weekNo = currentCulture.Calendar.GetWeekOfYear(DateTime

Get week number for the given date c#

江枫思渺然 提交于 2020-01-06 12:47:03
问题 I have tried searching for a solution which gives the correct week number for the date value. link1, link2,link3 Followed the methods in the above links, but for the date 30/12/2014, I get the week number as 53. but it falls as 1st week of 2015 year. I tried the below methods to get the week number of the year for the specific date. private int GetWeekNumberOfTheYear() { var currentCulture = CultureInfo.CurrentCulture; // option 1 var weekNo = currentCulture.Calendar.GetWeekOfYear(DateTime

CultureAndRegionInfoBuilder registration

筅森魡賤 提交于 2020-01-05 10:21:26
问题 I have a web application that is very much driven by culture. I have created some custom cultures and registered them using CultureAndRegionInfoBuilder Once registered do I need to register periodically or is it sufficient to register once and they will be in place on the machine for every more. 回答1: Calling CultureAndRegionInfoBuilder.Register persists the current CultureAndRegionInfoBuilder object as a custom culture on the local computer and makes that culture available to all applications

CultureAndRegionInfoBuilder registration

我的梦境 提交于 2020-01-05 10:21:09
问题 I have a web application that is very much driven by culture. I have created some custom cultures and registered them using CultureAndRegionInfoBuilder Once registered do I need to register periodically or is it sufficient to register once and they will be in place on the machine for every more. 回答1: Calling CultureAndRegionInfoBuilder.Register persists the current CultureAndRegionInfoBuilder object as a custom culture on the local computer and makes that culture available to all applications

CultureAndRegionInfoBuilder registration

旧城冷巷雨未停 提交于 2020-01-05 10:21:05
问题 I have a web application that is very much driven by culture. I have created some custom cultures and registered them using CultureAndRegionInfoBuilder Once registered do I need to register periodically or is it sufficient to register once and they will be in place on the machine for every more. 回答1: Calling CultureAndRegionInfoBuilder.Register persists the current CultureAndRegionInfoBuilder object as a custom culture on the local computer and makes that culture available to all applications

Custom Formating a DateTimePicker using CultureInfo

倖福魔咒の 提交于 2020-01-05 06:45:12
问题 I am using the DateTimePicker control in a Vb.Net Windows project. I would like the date to reflect the Regional Settings on the user's computer, but also to show the month name, rather than the month number. For example, if my computer is set to English(US), I would like to see Nov 26 2009, and if my computer is set to English (NZ), I would like to see 26 Nov 2009 Is this possible? I know that I can set the CustomFormat property to say "dd MMM yyyy", but then that always shows 26 Nov 2009,

How do I set the UI language for a multi-threaded .NET process, independent of the OS language?

守給你的承諾、 提交于 2020-01-04 04:57:06
问题 Problem: I have a C# .NET 2.0 application developed on Windows 7 that has translated resources for multiple languages (ex. zh-CHS for Chinese, es for Spanish, etc.). I have a customer who wants to run their Windows 7 OS in English, but run my .NET application in Spanish ( es ). My application is multi-threaded, so just changing the culture of the main GUI thread is not sufficient for my needs (trust me, I tried). This is because other strings displayed to the user through the GUI are