currentculture

Instance is read-only Exception while changing culture in asp.net

拈花ヽ惹草 提交于 2021-01-29 05:51:52
问题 I try to implement multicultural application where users able to change language, date format and etc. I wrote core but it returns Exception: System.InvalidOperationException: Instance is read-only. switch (culture) { case SystemCulture.English: Thread.CurrentThread.CurrentCulture = new CultureInfo(CultureCodes.English); Thread.CurrentThread.CurrentUICulture = new CultureInfo(CultureCodes.English); break; //another cultures here } switch (cultureFormat) { case SystemDateFormat.European: var

Instance is read-only Exception while changing culture in asp.net

空扰寡人 提交于 2021-01-29 05:48:01
问题 I try to implement multicultural application where users able to change language, date format and etc. I wrote core but it returns Exception: System.InvalidOperationException: Instance is read-only. switch (culture) { case SystemCulture.English: Thread.CurrentThread.CurrentCulture = new CultureInfo(CultureCodes.English); Thread.CurrentThread.CurrentUICulture = new CultureInfo(CultureCodes.English); break; //another cultures here } switch (cultureFormat) { case SystemDateFormat.European: var

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]:

How to honor/inherit user's language settings in WinForm app?

孤街醉人 提交于 2020-02-04 05:41:44
问题 I have worked with globalization settings in the past but not within the .NET environment, which is the topic of this question. What I am seeing is most certainly due to knowledge I have yet to learn so I would appreciate illumination on the following. Setup: My default language setting is English (en-us specifically). I added a second language (Danish) on my development system (WinXP) and then opened the language bar so I could select either at will. I selected Danish on the language bar

Xamarin Form: How do i change from current device time to different country time

。_饼干妹妹 提交于 2020-01-16 09:05:10
问题 I am not too familiar with date time. I am currently wonder how can I convert the existing time of the device to a different countries' date/time. E.g. App.CurrentDate <- which display the device setting date/time. I want it to be in different country's time when choosing different site where the site can be any countries Is it possible to achieve this? 回答1: Android and iOS use IANA timezone names. They look like this “America/New_York” and you can find a list of them at the List of tz

ASP.NET MVC 5 localization resources freeze and do not change language despite changing CurrentThread.CurrentCulture

戏子无情 提交于 2020-01-03 03:15:35
问题 I have an ASP.NET MVC 5 WEB Application running under a website in IIS 8 where I need to change language programmatically at runtime by a user preference that I read from a DB and store in a session variable, and this value can change during runtime with a dropdown. The problem is language resources sometimes do not change, despite the CurrentCulture does and the worse thing is they freeze at an application level making that all the other user sessions to freeze to that language too and will

Changing CurrentUICulture at runtime in a Localizable Form in WinForms

☆樱花仙子☆ 提交于 2019-12-29 01:52:13
问题 I have been searching about how to change the language of a Form that has the Localizable attribute set to true. https://msdn.microsoft.com/en-us/library/system.threading.thread.currentuiculture(v=vs.110).aspx This is to set the language of the form, but this needs to be set before we instantiate the form. This cannot be called after this event. Searching for information, I have seen the following question: https://stackoverflow.com/a/11738932/3286975 but, as a comment said, I have controls

C# doubles show comma instead of period

最后都变了- 提交于 2019-12-18 05:47:06
问题 I almost have the same problem as the guy in this thread: Convert Float that has period instead of comma? So that my double x = 234.4; string y = x.ToString(); I get y == "234,4" ; Even worse ... Double.Parse("234.4") throws an exception. I have written alot of code before I was asked to use period instead of comma, so I would prefer to have some way to change my CultureInfo at a global level . Is there some setting in the projects that I can do? I've tried: Application.CurrentCulture =

Best way to parse float?

こ雲淡風輕ζ 提交于 2019-12-17 10:38:21
问题 What is the best way to parse a float in CSharp? I know about TryParse, but what I'm particularly wondering about is dots, commas etc. I'm having problems with my website. On my dev server, the ',' is for decimals, the '.' for separator. On the prod server though, it is the other way round. How can I best capture this? 回答1: Depends where the input is coming from. If your input comes from the user, you should use the CultureInfo the user/page is using (Thread.CurrentThread.CurrentUICulture).