globalization

ResourceManager not selecting correct resource set when using custom culture

有些话、适合烂在心里 提交于 2019-12-22 03:55:12
问题 I have created a localized MVC website using the code found on this blog by Alex Adamyan. This is working great if I use an existing culture. However, I am trying to localize for Tagalog (tl or tl-PH). Windows does not have this culture built in so I have created one (I have tried both tl and tl-PH) as per the code below: public static void CreateCustomCultures() { var cultureBuilder = new CultureAndRegionInfoBuilder( "tl", CultureAndRegionModifiers.Neutral); cultureBuilder

ToString(“0”) versus ToString(CultureInfo.InvariantCulture)

余生颓废 提交于 2019-12-22 03:24:07
问题 I would like to make sure that certain numbers in my application are printed without any separators, groupings etc. no matter what the current environment is. It seems that the following two methods produce the same results (there are possibly more): 123456789.ToString("0"); 123456789.ToString(CultureInfo.InvariantCulture); Are you aware of any edge cases or quirks? Which one is more "correct"? Which one would you use? I used to use the second one, but recently I found the first one and

How to call EnumSystemLocales in Delphi?

放肆的年华 提交于 2019-12-21 09:19:23
问题 i am trying to call EnumSystemLocales in Delphi. For example: { Called for each supported locale. } function LocalesCallback(Name: PChar): BOOL; stdcall; begin OutputDebugString(Name); Result := Bool(1); //True end; procedure TForm1.Button1Click(Sender: TObject); begin EnumSystemLocales(@LocalesCallback, LCID_SUPPORTED); end; The problem is that the callback is only being called once. Note: EnumSystemLocales is returning true, indicating success. The remarks of EnumSystemLocales says that my

Convert language abbreviation to full name, e.g. en to English?

筅森魡賤 提交于 2019-12-21 06:27:36
问题 quick question, what's the best way to convert language a abbreviation to full name? e.g. en to English? Note, it's not en-US, it's just en, fr, de C# please. 回答1: I'm not sure you can get it from just en... You can do this though if you know the rest of the abbrevation: System.Globalization.RegionInfo info = new System.Globalization.RegionInfo("en-GB"); string countryName = info.EnglishName; Edit: Actually, you can do it: CultureInfo info = new CultureInfo("en"); string englishName = info

How to display localized date and time information to web users with ASP.NET

元气小坏坏 提交于 2019-12-21 04:27:15
问题 I have an ASP.NET application and a UTC time stamp on the server. I want to display the time stamp to the user in the right time zone and using local date/time format . E.g. Jan 2, 2012 14:00:00 UTC should show as 1/2/2012 9:00 AM to a user in New York, United States (UTC -0500) and as 02/01/2012 14:00 to a user in London, UK. This seemingly simple task proved to be surprisingly difficult. MSDN has an article with the same title, but it talks about parsing user input rather than displaying

Translate custom attributes with i18next (placeholder, value)

此生再无相见时 提交于 2019-12-21 03:37:30
问题 I am investigating what is possible with i18next localization library. Right now I have the following code (full Fiddle is here): HTML <div data-i18n="title"></div> <input placeholder="Hello" value="name"> <div class="holder"></div> <button class="lang" data-lang="en">Eng</button> <button class="lang" data-lang="ch">Chi</button> JS $(document).ready(function () { i18n.init({ "lng": 'en', "resStore": resources, "fallbackLng" : 'en' }, function (t) { $(document).i18n(); }); $('.lang').click

MVC3 globalization: need global filter before model binding

三世轮回 提交于 2019-12-21 03:37:07
问题 Currently, I have a global filter called GlobalizationFilter that checks the route values, cookies and browser languages header to determine the correct culture settings for the request: public override void OnActionExecuting(ActionExecutingContext filterContext) { // determine cultureInfo Thread.CurrentThread.CurrentCulture = cultureInfo; Thread.CurrentThread.CurrentUICulture = cultureInfo; } It all works, but the model binding process seems to occur before the global filters, and so the

Should I use DateTime.Now or DateTime.UtcNow in HttpCookie.Expires and HttpCachePolicy.SetExpires?

偶尔善良 提交于 2019-12-21 03:19:12
问题 Should I use DateTime.Now or DateTime.UtcNow in HttpCookie.Expires and HttpCachePolicy.SetExpires ? Cookies are sending 'GMT' time, but I don't know what happen if I send DateTime.Now.AddDays(3) if I would be in GMT+5. Same with Expires HTTP header (sec 14.21). What should I use? 回答1: It doesn't matter in this case. Internally, the first thing .SetExpires does is convert your supplied datetime into UTC, before setting it on the cookie. Bear in mind, as long as your datetime consumer uses the

What is the actual differences between I18n/L10n/G11n and specifically what does each mean for development? [duplicate]

人走茶凉 提交于 2019-12-20 08:01:31
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Localization and internationalization, what’s the difference? I18n/L10n/G11n all equal localization to me, but people keep making distinctions among these, especially in corporate and marketing, but I'm failing to see how these 3 tasks, from the programmer's point of view aren't the same thing, are there special requirements behind each one of these? What is some honest programmer to programmer explanations of

Once localized with .resx files, how to enable client to view entire website in their language?

浪子不回头ぞ 提交于 2019-12-20 07:16:09
问题 Most of my .resx files are in App_GlobalResources (explicit), and the master pages are in the App_LocalResources in their directories (implicit). I have to top line in all my pages set to culture / uiculture - auto . Now that my languages are set up, Nuux explained to me how to create a drop-down box and translate that particular page, and this is great -- a lot more than I had. But what if I want the end-user to see an array of flags on the homepage, so they can manually opt to view the