globalization

Formatting Numbers as Strings with Commas in place of Decimals

点点圈 提交于 2019-12-28 04:13:22
问题 I have the following number: 4.3 I'd like to display this number as 4,3 for some of our European friends. I was under the impression that the following line would do the trick: string ret = string.Format("{0:0,0}", 4.3); // returns "04", not "4,3" Am I using the incorrect string? 回答1: I think: string.Format(System.Globalization.CultureInfo.GetCultureInfo("de-DE"), "{0:0.0}", 4.3); should do what you want. 回答2: NumberFormatInfo nfi = new NumberFormatInfo(); nfi.NumberDecimalSeparator = ",";

InitializeCulture change language of domain

邮差的信 提交于 2019-12-25 09:49:40
问题 I have a MasterPage with a combo with languages, the thing is that I would like to assign a default language the moment a user starts the application, after that the user can change between languages. What I understand is that I have to override InitializeCulture method on all of the pages, the problem is, where I can save the selected language? When I use Cache["Culture"] all of the user that starts the application shares the same Cache and overrides the value for all the users logged in.

How to get client's system “Region and Language” settings on server?

本小妞迷上赌 提交于 2019-12-25 09:47:52
问题 Is there any way to get format settings (country from "Formats" tab on "Region and Language" popup in Windows) in JavaScript so I can pass it to server in cookie? (big target - display dates in correct format on MVC 4 server-side) In IE9 I can use navigator.UserLanguage (also correct language is passed in Accept-Language http header). But in Chrome and FF navigator.UserLanguage is undefined, navigator.language and Accept-Language returns browser's interface language. 回答1: It is not possible

Localizaion using Resource file in .Net Core for different Culture

拟墨画扇 提交于 2019-12-25 06:33:11
问题 I am working on .Net Core application and I wanted to implement Localization based on Culture info using Resource files for different culture. I have created Resource files for English and German culture as below: And also I have setup few things and set Default culture and German (de-DE) in Startup.cs as below : public void ConfigureServices(IServiceCollection services) { // Add framework services. services.AddDbContext<ApplicationDbContext>(options => options.UseSqlServer(Configuration

CultureInfo for Japanese language not setting up DateTimeFormat.AbbreviatedMonthNames property correctly

时光总嘲笑我的痴心妄想 提交于 2019-12-25 04:07:03
问题 I wanted to show the date in dd-MMM-yyyy format for Japanese culture in a web application. Hence I wrote below simple code. CultureInfo cu = new CultureInfo("ja-JP"); System.Threading.Thread.CurrentThread.CurrentCulture = cu; System.Threading.Thread.CurrentThread.CurrentUICulture = cu; lbl1.Text = DateTime.Now.ToString("dd-MMM-yyyy"); But found that the label prints the month number instead of the month name. i.e. it shows 30-10-2014 instead of something 3 letter month name in japanese. After

Globalization and links in sentences

社会主义新天地 提交于 2019-12-24 22:14:22
问题 I am working on globalizing/localizing an asp.net application with C# as the backend. We are in the process of extracting strings to a resource file, and have run into a problem. We are trying to keep sentences together so that they are translatable, but this is not possible with links. For Example: <%= Strings.BeginningOfSentence %> <asp:HyperLink id="exampleLink" runat="server"><%= Strings.MiddleOfSentence %></asp:HyperLink> <%= Strings.EndOfSentence %> Strings is the resource file. If this

ASP .NET MVC DateTime globalization. “The field Date must be a date.”

我的梦境 提交于 2019-12-24 16:58:58
问题 I have made a simple mvc app to test globalization/localization. I have made Resources.resx file and Resources.es.resx (spanish) file where I have strings that I want translated. All strings are translated fine, but with DateTime format I am experiencing difficulties. In the partial view I am using I use xd-soft datetimepicker for my date field like this: razor syntax: <div class="form-group"> @Html.LabelFor(model => model.Date, htmlAttributes: new { @class = "control-label col-md-3" }) <div

Currency, Calendar changes to selected language, but not label in asp.net?

僤鯓⒐⒋嵵緔 提交于 2019-12-24 10:44:36
问题 I have an webpage with a calendar, a label to hold a currency value, and a label to say hello. When I select a language from the dropdown, it changes the currency label, the calendar, but hello does not change. Here is the stripped down code for the aspx page and the cs file: ASPX: <asp:Label ID="lblLanguageSelection" runat="server" Text="Select a language: "></asp:Label> <asp:DropDownList ID="ddlLanguages" runat="server" AutoPostBack="true"> <asp:ListItem Value="auto">Auto</asp:ListItem>

How do I set my Oracle session's globalization to be the same as Windows in .NET?

佐手、 提交于 2019-12-24 03:24:20
问题 For example, it would be great if I could do the following: private void SetSessionGlobalization(Oracle.DataAccess.Client.OracleConnection aConnection) { System.Globalization.CultureInfo lCultureInfo = System.Threading.Thread.CurrentThread.CurrentCulture; aConnection.SetSessionInfo(lCultureInfo); } But that does not work because SetSessionInfo takes a OracleGlobalization class as a parameter, not a CultureInfo! And this does not work either: private void SetSessionGlobalization(Oracle

Globalized custom number formatting - Variable decimal points

荒凉一梦 提交于 2019-12-23 20:53:13
问题 I'm trying to alter the existing number formatting in my company's application to make it more readable for international users. This is a stock trading application, so most stock prices come in with numbers precise to 2 decimal points, like so-> 17.23 We could also get ticks in that have precision out to 4 decimal points, so a penny stock might be 0.0341. The original string format that we were using for stocks was "#,##0.00##" Which would give us the format we wanted (essentially trimming