globalization

List of all available languages for Windows .NET framework

非 Y 不嫁゛ 提交于 2019-11-29 14:42:20
问题 I've been searching for the answer over the net, but I don't seem to be able to find a comprehensive list of all languages available for my app with their exact display name. (I find many lists, but none of them seem to match the language strings I have. Read on.) The closest one I found is this one, but is not complete. I am coding a plugin in C# where the text is exported from SDL Trados Studio to Word and the language is set accordingly in Word. I need to write a custom method that casts

ASP.NET MVC 3 : - Using database instead of resource files as the localization store

本小妞迷上赌 提交于 2019-11-29 14:02:53
问题 We have localised strings in the database and would like to know if extending the ASP.NET Resource Provider Model would work with the ASP.NET MVC 3 Razor view engine. Kindly let me know if ASP.NET MVC 3 Razor view engine supports retrieving localized strings from the database once we have extended the ASP.NET Resource Provider model. Or does it work only with Classic ASP.NET and not with ASP.NET MVC. Thank you Satyaprakash J 回答1: The cleanest solution I've found so far is: http://www

How to parse string to decimal with currency symbol?

邮差的信 提交于 2019-11-29 13:26:05
I have no idea why this is not working: string s = "12,00 €"; var germanCulture = CultureInfo.CreateSpecificCulture("de-DE"); decimal d; if (decimal.TryParse(s, NumberStyles.AllowCurrencySymbol, germanCulture, out d)) { // i want to get to this point Console.WriteLine("Decimal value: {0}", d); } Use NumberStyles.Currency instead of NumberStyles.AllowCurrencySymbol if (decimal.TryParse(s, NumberStyles.Currency, germanCulture, out d)) and the output for you code would be: Decimal value: 12.00 Try this; string.Format(new CultureInfo("en-SG", false), "{0:c0}", 123423.083234); It will convert

Should Exception Messages be Globalized

大城市里の小女人 提交于 2019-11-29 13:11:47
问题 I'm working on a project and I'm just starting to do all the work necessary to globalize the application. One thing that comes up quite often is whether to globalize the exception messages, but ensuring that string.Format uses CultureInfo.CurrentCulture instead of CultureInfo.InvariantCulture. Additionally this would mean that exception messages would be stored in resource files that can be marked as culture-specific. So the question is, should exception messages be globalized or should be be

Language Bar change language in c# .NET

大兔子大兔子 提交于 2019-11-29 13:03:49
TL;DR : Trying to solve the issue that InputLanguage changes the input layout but does not update the Language Bar display. I am writing a custom plugin for Trados Studio. Part of this is interfacing with languages both in the app itself and in Word, as in this question: List of all available languages for Windows .NET framework The last problem I seem to cannot solve is that in a part of the code I am using InputLanguage to set the keyboard input to en-US. To clarify, there is a limited API, so I have to be really inventive in automating certain aspects. The best workable approach was to use

When should I specify CurrentCulture or InvariantCulture and when should I leave it unspecified?

拟墨画扇 提交于 2019-11-29 11:16:52
问题 What is the best practice for specifying CurrentCulture or InvariantCulture and not specifying the culture at all? From what I have read, if you're doing serialization, for instance, you need InvariantCulture as a means of specifying a canonical representation of a data value. That's a relatively small percentage of culture-based string manipulations. I find it long, verbose, and ugly most of the time to specify it every time I do, say: var greeting = string.Format(CultureInfo.CurrentCulture,

How to use image resource in asp.net website?

丶灬走出姿态 提交于 2019-11-29 09:56:45
I have a c# site which makes use of a lot of images with embedded english text. How can I use a standard resource file to swap out images depending on the language? I have a resx file in my App_GlobalResources directory, but I can't seem to get it plugged into an asp:image control for the imageurl correctly. Ideas? UPDATE: For some further information, here is the image tag code: <asp:image runat="server" ID="img2" ImageUrl="<%$Resources: Resource, cs_logo %>" /> The result on the client side is: <img id="img2" src="System.Drawing.Bitmap" style="border-width:0px;" /> Note that the source is

How to set culture for date binding in Asp.Net Core?

江枫思渺然 提交于 2019-11-29 09:29:19
I have an Asp.Net Core application with MVC. I'm submitting a form with a date on the form. Form looks (roughly) like this: @model EditCustomerViewModel <form asp-action="Edit"> <input asp-for="ServiceStartDate" class="form-control" type="date" /> <input type="submit" value="Update" class="btn btn-success" /> </form> Controller action is: [HttpPost] public async Task<IActionResult> Edit(EditCustomerViewModel viewModel) { // do stuff return RedirectToAction("Index"); } View model is: public class EditCustomerViewModel { public Guid Id { get; set; } [DataType(DataType.Date)] public DateTime

Why do I get, “Culture is not supported” and What, if Anything, Should I Do about it?

冷暖自知 提交于 2019-11-29 09:27:20
I have a breakpoint on the "return" line here: [HttpGet] [Route("api/Test/{id1}/{id2}")] public NRBQEntity GetTestMessage(String id1, String id2) { return NRBQClient.GetTestMessage(id1, id2); } Although it does not crash the app, when I reach that point, I get, " Exception:Thrown: "Culture is not supported." (System.Globalization.CultureNotFoundException) A System.Globalization.CultureNotFoundException was thrown: "Culture is not supported." " Which culture is trying to be supported, why is it not supported, and what, if anything, should I do to support the culture? UPDATE Answer to sphanley:

DataAnnotations and Resources don't play nicely

左心房为你撑大大i 提交于 2019-11-29 06:38:05
I'm using dataannotations in an MVC2 app and am a little discouraged when trying to use RESX file resources for error messages. I've tried the following but keep getting the exception "An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type" [Required(ErrorMessage = Resources.ErrorMessages.Required)] [Required(ErrorMessageResourceName = Resources.ErrorMessages.Required, ErrorMessageResourceType = typeof(Resources.ErrorMessages)] I keep getting that error message unless I replace ErrorMessageResourceName with "Required"