globalization

Are there localization tools which spot content strings in xaml/wpf?

谁说胖子不能爱 提交于 2019-12-05 15:49:49
When globalizing a wpf application with static resx classes, it's very easy to miss the odd label or button that has its Content property set to a hard coded string in a particular language, ie English. These should of course be moved off to a {x:Static ...} so they can be localised for each culture. Are there any tools which can spot this and warn you? Built in to VS would be ideal, but I'm thinking that 'style cop' type build tools would do the job as well. David Anson posted just such a tool a few weeks ago. It's a pseudo-localization tool that alters all the strings defined in ResX files

Generating Resx files for MVC

情到浓时终转凉″ 提交于 2019-12-05 15:37:34
We use resx files for globalization, along with database lookups for things that can be configured (such as tab names, which can be different by product) by our CS staff, and thus aren't known at design-time. I created a custom tool that reads resx files and intelligently dumps the key/value pairs into a relational database (matching values so we don't have duplicates). This has been a big help to our business - we don't have to send each resx for translation (and pay for duplicate translations of shared words) and we have a 'gold standard' with all our translations (in the database). The tool

validating date format not working

点点圈 提交于 2019-12-05 13:48:00
I'm having problem with date validation. In my View, I have a jQuery datepicker - I changed the format from yy/mm/dd to mm/dd/yy and now I get client-side validation errors. For example, The value '02/25/2014' is not valid for Date of Birth. The Javascript: $('#DateOfBirth').datepicker({ changeMonth: true, changeYear: true, dateFormat: "mm/dd/yy", yearRange: "-90:-5" }); The View Model: [Required] [Display(Name = "Date of Birth")] public DateTime? DateOfBirth { get; set; } The View: @Html.TextBoxFor(m=> m.DateOfBirth, "{0:MM/dd/yyyy}", new { @class = "datepicker" }) Any ideas on this? Thanks.

ASP.net is not using other locale resource files

扶醉桌前 提交于 2019-12-05 07:27:11
i have a Default.aspx file where i fetch localized values: Default.aspx : <asp:Localize meta:resourcekey="lblTitle" runat="server">Welcome</asp:Localize> i then create a matching fallback resource file: Default.aspx.resx : lblTitle.Text Welcome to Stackoverflow Localized And that works: Now i want to create, for example, a French localization: Default.aspx.fr.resx : lblTitle.Text Bienvenue Stackoverflow And i change my browser to send a french language locale: (which it does): GET http://stackoverflow.com/ HTTP/1.1 Accept: application/x-ms-application, image/jpeg, application/xaml+xml, image

Country name to ISO 3166-2 code

烈酒焚心 提交于 2019-12-05 06:48:49
I know how to convert an ISO 3166-2 code to the full English name, e.g. "US" to "United States" by using RegionInfo . However, how can I do the opposite, i.e. that takes "United States" and returns "US"? //Get the cultureinfo RegionInfo rInfo = new RegionInfo("us"); string s = rInfo.EnglishName; //Convert it back CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.SpecificCultures); CultureInfo cInfo = cultures.FirstOrDefault(culture => new RegionInfo(culture.LCID).EnglishName == s); yesenin The main idea: take all region objects and select from them one which contains given full

<system.web> globalization in .net core

こ雲淡風輕ζ 提交于 2019-12-05 05:08:54
问题 I have been using the following setting the the web.config of my previous application. <system.web> <globalization culture="en-AU" uiCulture="en-AU" /> </system.web> Now in my new .net core project I don't know how to put this setting in the appsettings.json file. Thanks for your help, Nikolai 回答1: The localization is configured in the Startup class and can be used throughout the application. The AddLocalization method is used in the ConfigureServices to define the resources and localization.

Best place to set CurrentCulture for multilingual ASP.NET WebAPI applications

风格不统一 提交于 2019-12-05 04:26:53
based on this question ( Best place to set CurrentCulture for multilingual ASP.NET MVC web applications ) I'm looking for a global way to do the same for ASP.NET WebAPI. My current implementation for ASP.NET MVC looks like this: public class MvcApplication : System.Web.HttpApplication { protected void Application_Start() { AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); ControllerBuilder.Current

Translating a Visual Studio project

余生颓废 提交于 2019-12-04 21:38:21
I have a big project written in my native language (hun) in c# with Visual Studio 2012. I'd like to translate it to english. Of course if I get a text in hungarian, I can translate it, so the point is not about how to translate a text, but how to make the whole translation easier. I don't need the software to change the language while runtime, it is also ok if I get a different project with a different language. One way is go go through the whole project and change all the labels, but that's a lot of work, and because I modify the whole project, I would have to do it all over again. I've

Opposite method to toLocaleDateString

元气小坏坏 提交于 2019-12-04 20:07:45
In order to create a string that respects the browser culture, we can do: var myDate = new Date(); var myDateString = myDate.toLocaleDateString(myDate); //returns a string Which is nice, because if I'm in Portugal, for the 1st of June, this will output "01/06/2015", while if I'm on the states, it will output "06/01/2015". Now I want the exact opposite. I want: var myDateString = "01/06/2015" var myDate = myDateString.toLocaleDate(); //it should return a Date Any suggestions? Browsers have no idea what "culture" a user identifies with, it only has access to regional settings for various

InitializeCulture() on every single page necessary?

佐手、 提交于 2019-12-04 19:40:09
I have a web forms site that needs to be localized. I mean, it is localized, I just need to set the right language according to the domain. Something like: protected override void InitializeCulture() { var i = Request.Url.Host.ToLower(); var domain = i.Substring(i.Length - 2, 2); if (domain == "se") { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("sv-SE"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("sv-SE"); } else if (domain == "dk") { Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("da-DK"); Thread.CurrentThread.CurrentUICulture