globalization

Questions on localization/globalization of Ctype & .ToString

与世无争的帅哥 提交于 2019-12-11 10:10:01
问题 A few questions I need answered to help debug an issue I'm having with globalization/localization that's leaving me rather stumped. 1) How exactly does CType work if I convert a string into a double when it comes to globalization/localization? From my research, and asking other developers in the office, I think CType should use whatever culture settings you have on your computer. So for example CType("1.23", Double) would work fine for a US culture computer. But it would mess up by converting

Dynamically loading a resource and reading the correct value for the CurrentUICulture

时间秒杀一切 提交于 2019-12-11 06:03:09
问题 I'm creating a method to convert an enum to a friendly string. The friendly names are stored in a resource file and are subject to globalization. So I created two resource file: Enums.resx and Enums.pt-BR.resx whose keys are the name of the enum followed by it's value (i.e DeliveryStatus_WaitingForPayment). This is the code I'm using to load the resource and get the corresponding friendly name for the enum: public static string EnumToString<T>(object obj) { string key = String.Empty; Type

Globalization of CultureInfo & DateTimeFormatInfo: How can we change digits format to my language?

我的梦境 提交于 2019-12-11 05:49:23
问题 I use System.Globalization like below: CultureInfo calture = new CultureInfo(MyCultureInfoGoesHere); DateTimeFormatInfo info = calture.DateTimeFormat; info.AbbreviatedDayNames = new string[] { "bla", "bla", "bla", "bla", "bla", "bla", "bla" }; info.ShortestDayNames = new string[] { "bla", "bla", "bla", "bla", "bla", "bla", "bla" }; info.DayNames = new string[] { "bla", "bla", "bla", "bla", "bla", "bla", "bla" }; info.AbbreviatedMonthNames = new string[] { "bla", "bla", "bla", "bla", "bla",

Adobe Air - Textfield with Chinese characters

醉酒当歌 提交于 2019-12-11 04:33:52
问题 I've a contact form that needs to support Chinese characters. Right now if I enter Chinese text nothing shows up. (Not even the empty box placeholder) How to handle Chinese characters in an Adobe Air dynamic textfield? Thanks. Uli 回答1: Can' you just embed the font you are using to include the Chinese characters you need? 回答2: Ok thats a few years late... but just use "_sans" as font. If you develop for mobile, it will use the device fonts, which support everything, but look differently from

Round brackets not showing up correctly in RightToLeft flow direction in WPF

假装没事ソ 提交于 2019-12-11 03:59:59
问题 Flow direction in my WPF window is set to RightToLeft like so: <TextBlock FlowDirection="RightToLeft" x:Name="test"> In code if I do test.Text = "(2/3)"; I see (2/3) But if I do test.Text = "asdf (2/3)"; I see (asdf (2/3 What's going on here? Why is it that starting the text with a string changes the positioning of the brackets? 回答1: I am not sure, but another more complex workaround is: Friday, February 12, 2010 5:10 PM Ben Ronco - MSFT Unfortunately this is a bug that we have recently

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

How to solve the “Can't mass-assign protected attributes: translations_attributes” error?

北城余情 提交于 2019-12-11 02:47:01
问题 I am using Ruby on Rails (3.2.2), globalize3 (0.2.0) and batch_translations (0.1.2) ruby-gems. I would like to solve the following problem generated when using the batch_translations ruby-gem: ActiveModel::MassAssignmentSecurity::Error in Admin::ArticlesController#update Can't mass-assign protected attributes: translations_attributes In my ROOT_RAILS/Gemfile file I have: ... gem 'globalize3' gem 'batch_translations' In my ROOT_RAILS/app/models/admin/article.rb file I have: class Admin:

Display equivalent of “MMM d, yyyy” in current culture info

浪子不回头ぞ 提交于 2019-12-11 01:43:06
问题 I've perused the standard datetime formatters that C# offers, and I can't seem to find one that matches my "short date" requirement: "May 4, 2013". I know that I can do a custom format string to accomplish the goal: myDateTimeOffset.ToString("MMM d, yyyy"); However, this application may go to other countries. Is there a way to get the current culture's equivalent to a particular format string? myDateTimeOffset.ToString("MMM d, yyyy", CultureInfo.CurrentUICulture); And have it adapt to an

Detecting number format culture settings

我是研究僧i 提交于 2019-12-10 20:58:00
问题 I have a webpage that needs to take numeric input, this part is easy enough with some combination of parseFloat, isNaN and (for displaying the values back to the user) toFixed. The problem is that Javascript seems to be completely ignorant of culture here. Some cultures use a decimal comma instead of a decimal point, but Javascript bulks at this. Supporting the decimal comma isn't too much trouble, I can just replace a comma with a decimal point before parsing the users input and I can do the

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