culture

How can I change resource files for a c# winform app, without changing the culture?

我的未来我决定 提交于 2019-12-10 18:53:10
问题 We have a winform app that has been in development for some time. It has several images and control colours that create a branded experience. We have a second customer who would like the same product, but with different branding. So we have lines of code in the control designer.cs files like: this.BackgroundImage = global::MyNameSpace.Properties.Resources.background; It seems like resource files are the way to go, as I could simply change the culture and have a separate resource file with

Instances of CultureInfo (from same culture) changing based on OS

六眼飞鱼酱① 提交于 2019-12-10 15:29:10
问题 I've a web site which writes a date like this: CultureInfo cultureInfo = CultureInfo.GetCultures(CultureTypes.AllCultures).FirstOrDefault(c => string.Equals(c.TwoLetterISOLanguageName, MvcApplication.Language)); return string.Concat(date.Day, ".", cultureInfo.DateTimeFormat.GetAbbreviatedMonthName(date.Month)); In both my PC (Windows 7, Service Pack 1, Spanish culture) and the server (Windows Server 2012, English Culture) the MvcApplication.Language is es so the culture I get from the list is

How do I detect a NumberDecimalSeparator in a KeyDown event (C#)

删除回忆录丶 提交于 2019-12-10 13:54:30
问题 I'm trying to see if the user has pressed a decimal separator in a text box, and either allow or suppress it depending on other parameters. The NumberdecimalSeparator returns as 46, or '.' on my US system. Many other countries use ',' as the separator. The KeyDown event sets the KeyValue to 190 when I press the period. Do I just continue to look for commas/periods, or is there a better way? 回答1: The call CultureInfo.CurrentUICulture.NumberFormat.NumberDecimalSeparator gets the decimal

Is Culture in C# equivalent to Locale in Java?

拈花ヽ惹草 提交于 2019-12-10 12:35:30
问题 C# uses the concept of Culture. Is this operationally similar to Locale in Java or are there significant differences in the underlying concepts? 回答1: Working in terms of Culture rather than Locale is an attempt at finding the correct level of abstraction — considering things in terms of groups of people who do things in similar ways, rather than talking about geographic areas and languages and somewhat derangedly thinking those correspond reliably to sets of cultural conventions. They're

String.FormatException with DateTime in non US Culture

南楼画角 提交于 2019-12-10 03:52:09
问题 I am getting a String.FormatException trying to convert/parse a string when the culture is other than non-US. The odd thing is that the string was generated by applying the very same format and culture as those being used to parse it back into a string. In the code below, all of these versions will fail: const string culture = "ja-JP"; const string format = "dd MMM yyyy"; //error in orignal post included {0:} CultureInfo info = new CultureInfo(culture); Thread.CurrentThread.CurrentCulture =

Processing of mongolian names

白昼怎懂夜的黑 提交于 2019-12-10 03:14:48
问题 There are several countries (Turkey, Mongolia, Kyrgyzstan etc.) where generally men's name can be without middlename and instead of it used words like "oglu, uulu" etc. For example "Michael oglu Bret" which means "Michael son of Bret". I used to split this kind of words and assume them as a middlename, so for the past week I feel doubts of correctness of the way I do it. Is there any standardized or some set of rules of how to process this kind of names? 回答1: I can't tell you what's best for

How to provide i18n service for developer and end user

混江龙づ霸主 提交于 2019-12-10 00:12:55
问题 Many android applications have quite poor i18n-support, and for an understandable reason, as it adds much work for the developer. From a both intuitive and cultural point of view it would be a good thing if end-users could translate the apps themself, and OTA share the translation, without reinstalling the app itself. In concept; as wikipedia, some add content easily, others only use what's there. It's of course important that the service is as easy as possible to use, both for app-developers

Is CultureInfo.CurrentCulture really necessary in String.Format()?

流过昼夜 提交于 2019-12-09 04:33:48
问题 How do you think is really necessary to provide IFormatProvider in method String.Format(string, object) ? Is it better to write full variant String.Format(CultureInfo.CurrentCulture, "String is {0}", str); or just String.Format("String is {0}", str); ? 回答1: In general, you will want to use InvariantCulture if the string you are generating is to be persisted in a way that is independent of the current user's culture (e.g. in the registry, or in a file). You will want to use CurrentCulture for

How to map a two letter ISO-3166 country code to a Culture in C#

早过忘川 提交于 2019-12-08 02:29:26
问题 I need to localize my C# DateTime object based on a two letter ISO-3166 country code https://en.wikipedia.org/wiki/ISO_3166-2 Is there a way to do it? I'm only able to apply a given culture using the 5 character country representation (en-US, nl-NL and so on..) System.Globalization.CultureInfo cultureinfo = new System.Globalization.CultureInfo("nl-NL"); DateTime dt = DateTime.Parse(date, cultureinfo); Even a surjective mapping would be ok (i.e. more than one country code map to a single C#

Currency Culture Formatting not applying on DataGridView Column

风流意气都作罢 提交于 2019-12-08 02:27:19
问题 I have 2 DataGridViews (DGV), and in both I have currency columns which I want to format. The code I'm writing seems to work in one, but not in the other. Both the DGV's are set up this way: Data is first loaded into a DataTable. A BindingSource then links to this DataTable. And lastly the DGV's use this BindingSource object for their data. I use the following code in the form's Load event to customize both DGVs' currency columns: dataGridView.Columns[columnIndexHere].DefaultCellStyle