culture

How format JavaScript Date with regard to the browser culture?

眉间皱痕 提交于 2019-12-17 14:56:20
问题 I need to format the JavaScript Date object. It should display date and time in short format with regard to the culture that browser is using, for example: 20/10/2011 10:20 PM 10.20.2011 22:20 How do I do this (preferably with jQuery)? 回答1: The Date() object will get you the client time (live demo here): var now=new Date(); alert(now.toLocaleString()); JS and jQuery don't have a built in format function. To format it differently use a function like format() (1.2kb) here and then the following

JavaScript parseFloat in Different Cultures

邮差的信 提交于 2019-12-17 12:11:39
问题 I have a question about the default behavior of JavaScript's parseFloat function in different parts of the world. In the US, if you call parseFloat on a string "123.34", you'd get a floating point number 123.34. If I'm developing code in say Sweden or Brazil and they use a comma instead of a period as the decimal separator, does the parseFloat function expect "123,34" or "123.34". Please note that I'm not asking how to parse a different culture's number format in the US. I'm asking does

Async WebApi Thread.CurrentCulture

十年热恋 提交于 2019-12-17 08:31:40
问题 I have a self-hosted OWIN hosted Web API project providing some basic REST methods for me. I want to have multilingual error messages, so I use Resource files and a BaseController that sets the Thread.CurrentCulture and Thread.CurrentUICulture to the Accept-Language header of the request. public override Task<HttpResponseMessage> ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken) { if (controllerContext.Request.Headers.AcceptLanguage != null &&

Change keyboard layouts through code c#

余生颓废 提交于 2019-12-13 08:03:49
问题 i am developing a multi-lingual application allowing users to change language as well as keyboard layouts (through combobox). I am able to change the culture of application successfully but i'm unable to change the individual keyboard layouts e.g. for English (United States), im unable to change layouts from QWERTY (default) to Dvorak - Left hand etc.. Plz help me in this matter. Thanks alot Here's the code (e.g. for English language), the imports etc are added already.. CultureInfo

Kendo DatePicker culture not working correctly

允我心安 提交于 2019-12-12 22:59:01
问题 I want to localize Kendo Datepicker to my culture "is-IS" but for some reason it doesn´t work correctly. This is code example: $("#RegisterDatePicker").kendoDatePicker({ start: "month", culture: "is-IS", value: new Date(), format: "dd.MMMM yyyy", events: { change: "registerDatePicker_OnChange" } }); The culture seems to revert to its default localization "en-US". I know this culture should work with Datepicker because whenever I declare the Datepicker within the Razor engine it renders

NUnit, testing against multiple cultures

五迷三道 提交于 2019-12-12 10:47:34
问题 Using NUnit I wish to run all the tests in a certain project against multiple cultures. The project deals with parsing data that should be culture neutral, to ensure this I would like to run every test against multiple cultures. The current solution I have is public abstract class FooTests { /* tests go here */ } [TestFixture, SetCulture ("en-GB")] public class FooTestsEN : FooTests {} [TestFixture, SetCulture ("pl-PL")] public class FooTestsPL : FooTests {} Ideally, I shouldn't have to

Current Culture is wrong in WinRT

荒凉一梦 提交于 2019-12-12 09:56:51
问题 I am trying to format the datetime value using Current Culture in WinRT. But CurrentCulture property not seems to respect the System Culture. I tried the following two properties, System.Globalization.CultureInfo.CurrentCulture.DisplayName System.Globalization.CultureInfo.CurrentUICulture.DisplayName Both gives English (United States) even though I change the region in Control Panel. But this works perfectly fine for WPF. What am I doing wrong? 回答1: WinRT uses APIs exposed in Windows

.NET 4.0 to 3.0 could not find any resources appropriate for the specified culture or the neutral culture

≯℡__Kan透↙ 提交于 2019-12-12 02:48:41
问题 I found a free program on the web that was .NET 4.0, but had to copy over the code to compile VS2008. I'm thinking the way cultures is handled must be different in the versions of .NET. I'm getting this error: System.Resources.MissingManifestResourceException: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "A.B.C.Resources.ExceptionMessage.resources" was correctly embedded or linked into assembly "A.B.C.csproj" at compile time, or that all

Time format in asp.net page

妖精的绣舞 提交于 2019-12-12 00:50:07
问题 i use telerik RadDateTime control for insert date and time into one table of SQL Server DB. The problem is about what i see in browser: when my grid is bind to the DB, it shows the cell containing the datetime value in format dd/MM/yyyy hh.mm.ss and i want to show this data in format dd/MM/yyyy hh:mm:ss because when i pass in edit mode, the RadDateTimeColumn shows correctly ":" instead of "." but next when i confirm the update or the insert, the parameter is passed to the storedprocedure in

.NET Globalization: Set Culture/UICulture on a Page or a Thread? What's the difference?

二次信任 提交于 2019-12-11 12:51:44
问题 Question title is basically the entire question. In ASP.NET you can set the Culture/UICulture properties of a page by overriding the InitializeCulture method, or you can set the properties of the current thread. What are the differences? What are the advantages/disadvantages of both? What situations would you use each option? 回答1: Both approaches ultimately set the properties on the current thread. The biggest difference is that the Page methods support automatic language detection - they can