culture

How to convert DateTime in different System culture?

守給你的承諾、 提交于 2019-12-11 10:26:20
问题 I need to convert DateTime value in different culture format, whatever set in system. There is not any specific TimeZone selected for converting, any culture format was using converting DateTime value. DateTimeFormatInfo ukDtfi = new CultureInfo(CultureInfo.CurrentCulture.ToString(), false).DateTimeFormat; StartingDate = Convert.ToDateTime(System.Web.HttpContext.Current.Session["StartDate"].ToString(), ukDtfi); I am using above code but its not working properly. Currently I set ar-SA culture

How to make Javascript “toString” implicite method culture aware

拥有回忆 提交于 2019-12-11 10:06:49
问题 in my ASP.NET MVC project, I need to make the JavaScript implicite string representation to be current culture aware , in particular with decimal separators. For example: var nbr = 12.25; console.log(nbr); Here, the console.log(nbr) must display "12.25" in EN-US and "12,25" in fr-FR, without having to explicitly call the toString() method. Does anyone know a way to accomplish this please? 回答1: You are probably looking for toLocaleString(); : The toLocaleString() method returns a string with a

Determine local culture of a PC without creating an application

落花浮王杯 提交于 2019-12-11 09:36:07
问题 Is there any way to determine the local culture of a PC (such as en-US) without running an application? I tried looking in Control Panel | Regional Settings (running WinXP), but I don't know how the choices there map to the PC's culture. I'm looking for a solution that doesn't require creating an .exe, such as running a command from the command prompt (not PowerShell), or a VbScript or JS file (as long as we are getting the real culture and not IE settings.) Thanks 回答1: To view the

enableClientBasedCulture vs culture in web.config

蓝咒 提交于 2019-12-11 08:58:11
问题 What is the difference between these two settings: <globalization enableClientBasedCulture="true" culture="auto"/> vs <globalization enableClientBasedCulture="false" culture="auto"/> Does culture="auto" override enableClientBasedCulture="false" in the second case? 回答1: msdn says enableClientBasedCulture is not used. http://msdn.microsoft.com/en-us/library/hy4kkhe0(v=vs.100).aspx 来源: https://stackoverflow.com/questions/8536715/enableclientbasedculture-vs-culture-in-web-config

Are there cultures in which the decimal separator is longer than one character?

邮差的信 提交于 2019-12-11 07:55:23
问题 I must write a stringToNumber parsing function that can use custom strings for the following: decimal separator ( . for en-US => 3.1415 ) thousands separator ( , for en-US => 1,000,000 ) positive sign ( + for en-US => +5 ) negative sign ( - for en-US => -5 ) Can I assume that these are only one character (which would make the implementation easier) or are there any cultures in which any of these are longer? 来源: https://stackoverflow.com/questions/46538917/are-there-cultures-in-which-the

How is CultureInfo.CurrentCulture determined?

梦想与她 提交于 2019-12-11 06:52:44
问题 I have a computer in Israel. I deployed an MVC website to the computer's IIS. In this website I show the CultureInfo.CurrentCulture (for my needs) and it shows "he-IL". I changed: Control Panel > Region and Language > Formats to English (US) . Also I changed Control Panel > Region and Language > Administrative > System Locale to English (US) and of course restarted the computer. But CultureInfo.CurrentCulture still shows me "he-IL"! How can I change it without touching the code - only by

CultureInfo.InvariantCulture in plain english

老子叫甜甜 提交于 2019-12-11 03:13:45
问题 I know that culture rules for dates/numbers is enough for an entire book, I think I have a simple question though.. Does using InvariantCulture basically mean that you explicitly define what culture the value (date/number/whatever) will be inputted/displayed as? And it overrides any other culture setting (such as the user agent's setting)? If an app is built for an audience of one and only one culture, would it make sense to use InvariantCulture and define how you want values inputted

ValidationMessageFor Language

谁说胖子不能爱 提交于 2019-12-11 02:59:04
问题 I am using ASP.NET MVC 5 . I am trying to get the message of the ValidationMessageFor in French. "The xxx field is required" -> "Le champ xxx est manquant". I have deployed my website in 2 servers Windows Server 2008 R2 SP1 + IIS 7 Windows Server 2012 + IIS 8 I added in my web.config this following line: <globalization culture="fr-FR" uiCulture="fr" /> Finally, I succeed in doing the "translation" for the WS 2012. But not with WS 2008, when I submit a form, I still have "The xxx field is

C# DateTime ToString Standard culture format

。_饼干妹妹 提交于 2019-12-11 01:10:52
问题 Can I alter the standard output format of a DateTime for a specific culture. Example: class Program { static void Main(string[] args) { PrintCultureDateTime("ca-ES"); PrintCultureDateTime("es-ES"); PrintCultureDateTime("en-US"); PrintCultureDateTime("en-GB"); PrintCultureDateTime("pt-PT"); } public static void PrintCultureDateTime(string culture) { string result = new DateTime(2017, 10, 1).ToString("d", CultureInfo.GetCultureInfo(culture)); Console.WriteLine(string.Format("{0}: {1}", culture,

Page.UICulture — How do I retrieve the Two Letter UICulture Code?

廉价感情. 提交于 2019-12-10 20:57:18
问题 In ASP.NET webforms, when setting UICulture="en" in the @Page directive, a Response.Write(Page.UICulture) returns the string "English" instead of the two letter language code "en" . Is the the only way to return the two letter language name by using this? CultureInfo.CurrentUICulture.TwoLetterISOLanguageName Or is there a better / more elegant way? 回答1: Honestly I don't know of any better way to do it. You could create an extension method, but that might be overkill: public static class