culture

c# datetime format

好久不见. 提交于 2021-02-19 06:38:27
问题 I wish to have a specific format for my DateTime depending on the current culture. So I try this: dateTime.ToString("dd/MM/yyyy hh:mm"); This is partially OK, the / gets replaced by the culture-specific separator. But the day and month order are not switched (like MM/dd) depending on the culture. Using .ToString("g") works, but that doesn't include the leading zero. How do I accomplish this? 回答1: I think this will do what you want: System.Globalization.DateTimeFormatInfo format = System

How to prevent resource assembly generation for embedded resources

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-09 11:45:55
问题 I have a project which embeds some files into it, two of which ends with .SMS.something . When the project is compiled, a satellite assembly for the "SMS" culture is generated even though I have not specified anywhere that I want to use satellite assemblies, and is it even a culture? I have searched all over the place for an explanation, but I am at a loss. The only things I found were people trying to embed their resource assemblies for actual cultures into their executable, but this is not

Understanding the get-culture command

你。 提交于 2021-01-28 12:04:40
问题 I recently had some trouble with culture dependent returned values from my powershell script. The same script returned different values, depending on which machine it was. So I thought that maybe the culture settings are different and for one server it returned. get-culture : de-DE for the other it was like : en-US One value is for the keyboard settings but what does the other (second) stand for? And is the second value bound to the OS installation or is that just a setting? Is there a

Changing an application's locale without changing the Windows locale

╄→尐↘猪︶ㄣ 提交于 2021-01-27 05:31:42
问题 I've got an interesting situation where locale settings has messed with my C# application, because I failed to realize that methods like Double.Parse will not convert "1000" to 1000, but do something unexpected due to the different numbering format. One solution to my problem would be to use something like double d = double.parse( "1000", new CultureInfo("en-US")); . Currently, I don't pass the CultureInfo. However, instead of having to make this change throughout the code, I was wondering if

German culture - get double number from JSON with a comma

a 夏天 提交于 2020-11-25 03:23:52
问题 I have an MVC Web-API application for inner use. I have some pages with forms and numeric fields. I need to install this on a German computer, and the users will be only Germans. In Germany they write "3,5" instead of "3.5" (with a comma). In IIS configuration the culture is "Invariant culture" and since the computer is German - the localize is "de-DE". When the users write "3,5" in the field - I can see in firebug that "3,5" is what is sent in JSON, but the server gets it as "35". Can I

PowerShell scope of changes in lines with multiple commands - UICulture

删除回忆录丶 提交于 2020-08-19 10:47:46
问题 During my tinkering with PS 5.1 related to the objective of question Fully change language for the current PowerShell session I observed a "strange" behavior: > [system.threading.thread]::currentthread.currentculture ; [system.threading.thread]::currentthread.currentuiculture ; LCID Name DisplayName ---- ---- ----------- 1033 en-US English (United States) 1033 en-US English (United States) > function Set-CultureWin([System.Globalization.CultureInfo] $culture) { [System.Threading.Thread]:

PowerShell scope of changes in lines with multiple commands - UICulture

谁说我不能喝 提交于 2020-08-19 10:47:45
问题 During my tinkering with PS 5.1 related to the objective of question Fully change language for the current PowerShell session I observed a "strange" behavior: > [system.threading.thread]::currentthread.currentculture ; [system.threading.thread]::currentthread.currentuiculture ; LCID Name DisplayName ---- ---- ----------- 1033 en-US English (United States) 1033 en-US English (United States) > function Set-CultureWin([System.Globalization.CultureInfo] $culture) { [System.Threading.Thread]: