culture

Change culture of Silverlight application

不问归期 提交于 2019-12-06 03:06:58
问题 I am working on a Silverlight app at the moment. I have a few datagrids/textblocks where I use standard binding to show values, some of which are dates. e.g. <sdk:DataGrid AutoGenerateColumns="False" IsReadOnly="True" ItemsSource="{Binding Path=MyCollection}"> <sdk:DataGrid.Columns> <sdk:DataGridTextColumn Binding="{Binding Path=Name, Mode=OneWay}" Header="Agent"/> <sdk:DataGridTextColumn Binding="{Binding Path=UpdateTime, Mode=OneWay}" Header="Update Time"/> </sdk:DataGrid.Columns> </sdk

Problem comparing French character Î

大城市里の小女人 提交于 2019-12-05 21:13:28
问题 When comparing "Île" and "Ile", C# does not consider these to be to be the same. string.Equals("Île", "Ile", StringComparison.InvariantCultureIgnoreCase) For all other accented characters I have come across the comparison works fine. Is there another comparison function I should use? 回答1: You are specifying to compare the strings using the Invariant culture's comparison rules. Evidently, in the invariant culture, the two strings are not considered equal. You can compare them in a culture

asp.net mvc where to set default culture?

限于喜欢 提交于 2019-12-05 12:59:23
For multilingual asp.net mvc web site. Where should i set thread's culture to default language (which is tr-TR for my case), in addition i need to save this in cookie if it does not exists. in Application_Start() or else ? I have multiple sites(domains), so i need to change default language site specific. example.com must set default culture to tr-TR example2.com must set default culture to en-US Try it setting in web.config <configuration> <system.web> <globalization uiCulture="en-GB" culture="en-GB" /> </system.web> </configuration> this is a more generic way to set the culture... Dragon You

<system.web> globalization in .net core

こ雲淡風輕ζ 提交于 2019-12-05 05:08:54
问题 I have been using the following setting the the web.config of my previous application. <system.web> <globalization culture="en-AU" uiCulture="en-AU" /> </system.web> Now in my new .net core project I don't know how to put this setting in the appsettings.json file. Thanks for your help, Nikolai 回答1: The localization is configured in the Startup class and can be used throughout the application. The AddLocalization method is used in the ConfigureServices to define the resources and localization.

String.FormatException with DateTime in non US Culture

大憨熊 提交于 2019-12-05 03:03:35
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 = info; Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(culture); //string

Change the current culture of a Powershell session, v3.0+ specific

為{幸葍}努か 提交于 2019-12-05 02:01:25
问题 I want to change the culture of accepted data and errors in my current interactive Powershell session. I am aware of this question powershell : changing the culture of current session and of this question Changing current culture on SuperUser. The main problem that it doesn't work with Powershell 3.0 and 4.0. PS C:\users\me\Documents> [system.threading.thread]::currentthread.currentculture LCID Name DisplayName ---- ---- ----------- 1049 ru-RU Русский (Россия) PS C:\users\me\Documents>

Opposite method to toLocaleDateString

元气小坏坏 提交于 2019-12-04 20:07:45
In order to create a string that respects the browser culture, we can do: var myDate = new Date(); var myDateString = myDate.toLocaleDateString(myDate); //returns a string Which is nice, because if I'm in Portugal, for the 1st of June, this will output "01/06/2015", while if I'm on the states, it will output "06/01/2015". Now I want the exact opposite. I want: var myDateString = "01/06/2015" var myDate = myDateString.toLocaleDate(); //it should return a Date Any suggestions? Browsers have no idea what "culture" a user identifies with, it only has access to regional settings for various

Problem with Convert.ToDateTime in asp.net

依然范特西╮ 提交于 2019-12-04 20:04:40
I have an application that works without any problem in a spanish server. When i uploaded the application into the online server (an english windows), im getting exceptions (of type "input string is not a valid Datetime/Int32") with Convert.ToDateTime and Convert.ToInt32. Are any web.config line that could help me in this matter? I tried adding a globalization element with the Spanish culture, but didnt worked. Could you give me a hand? Thanks in advance. Josema. You need: System.Globalization.CultureInfo culture = new System.Globalization.CultureInfo("es-ES"); DateTime myDateTime = Convert

Change the current culture of a Powershell session, v3.0+ specific

99封情书 提交于 2019-12-04 15:08:53
I want to change the culture of accepted data and errors in my current interactive Powershell session. I am aware of this question powershell : changing the culture of current session and of this question Changing current culture on SuperUser. The main problem that it doesn't work with Powershell 3.0 and 4.0. PS C:\users\me\Documents> [system.threading.thread]::currentthread.currentculture LCID Name DisplayName ---- ---- ----------- 1049 ru-RU Русский (Россия) PS C:\users\me\Documents> [system.threading.thread]::currentthread.currentculture=[system.globalization.cultureinfo]"en-US" PS C:\users

Persian Calender in MVC , Asp.net

旧时模样 提交于 2019-12-04 13:03:46
问题 I use a DateTime variable in MVC and I want to show Persian calender for @Html.EditorFor(x=> x.ProductionDate) How can I do it? 回答1: I found the solution 1.Go to www.amib.ir/weblog/?page_id=316 and download the latest version of "AMIB_jsPersianCal" 2.Add "js-persian-cal.min.js" and "js-persian-cal.css" and "pcal.png" to your project you can change the css for specified the Url of PNG file 3.Add the css and js file to your cshtml file <link href="@Url.Content("~/Content/js-persian-cal.css")"