globalization

How to get country name

懵懂的女人 提交于 2019-12-04 16:04:56
问题 I used the code below to get the list of culture type, is there a way on how to get just the country name? Thank you static void Main(string[] args) { StringBuilder sb = new StringBuilder(); foreach (CultureInfo ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) { sb.Append(ci.DisplayName); sb.AppendLine(); } Console.WriteLine(sb.ToString()); Console.ReadLine(); } Sample Output: Spanish (Puerto Rico) Spanish (United States) 回答1: Well, this regular expression seems to do the job in

Globalization in ASP.net MVC (Resource file per View vs Domain)

落爺英雄遲暮 提交于 2019-12-04 14:13:05
What is the best practice for keeping Resource files when it comes to ASP.net MVC globalization ? For Example, we have order processing system if we try to keep our resource files for domain i.e order.resx, customer.resx, etc or else we could try to keep resource files per view i.e OrderProcessingView.resx, CustomerView.resx, etc Common strings such as "Add", "Edit", "Delete" can handle by using common.resx file. Or Are there any other approaches to keep the resource files ? We are using some client side rendering (Jquery templates, Kendo templates) also. One of the localizability best

.NET Globalization & Satellite DLL's

萝らか妹 提交于 2019-12-04 13:27:52
问题 I'm working on localizing an app I've written in C#. Everything seems to be working nicely, using satellite resource assemblies to translate each form's strings (as per this tutorial: http://msdn.microsoft.com/en-us/library/y99d1cd3%28VS.71%29.aspx) However, the application will ultimately require quite a number of languages, which means loads of directories in my working directory (i.e. /zh-tw, /zh-cn, /fr-FR, /ja-JP, etc). I'd like to clean this up a bit by locating all of them within a

.NET RegionInfo class

我的未来我决定 提交于 2019-12-04 12:01:40
问题 When I try to create a new RegionInfo with certain ISO 3166 country codes ("BD" for Bangladesh, "SO" for Somalia, "LK" for Sri Lanka), I get an ArgumentException that says it's not recognized. What's the deal? The Intellisense of RegionInfo(string) says it conforms to ISO 3166, but these country/region codes are not supported? I don't get it. 回答1: .NET doesn't provide all Cultures/Regions out-of-the-box. Note the 'predefined' RegionInfos here: http://msdn.microsoft.com/en-us/library/system

Add second language support with root path in an existing ASP.NET WebForms site

前提是你 提交于 2019-12-04 11:43:17
I have inherited from a very small ASP.NET WebForms project, and my customer would like to add a second language to it. For every "somepage.aspx", I'd like to support a "second language path" version of it, like "fr/somepage.aspx". I'd like to handle this using normal globalization (CurrentCulture + resource files in both languages) and avoid having to duplicate each page. I must keep the original paths valid, thus I have excluded ASP.NET MVC for now (for lack of knowing if I could continue to support ".aspx" paths). Is this possible? Nick Bork URL Routing is avalaible in for ASP.NET. You

Localization. Extending ASP.NET Resx Resource Provider

梦想与她 提交于 2019-12-04 11:27:09
For my website I have a custom resource provider for localization purposes (localized strings are stored in database). It works just fine, but I would like it to work with the default Resx Resource Provider: look up localized string in resx resources and if doesn't exist then pull it from the database. But it looks that as soon as I change IIS globalization setting to use my own resource provider factory, then the default resx resource provider factory gets ignored. I guess the solution would be to extend my own resource provider, but I can't find how to reference resx resources from inside of

Using a CSS File for site localization

你说的曾经没有我的故事 提交于 2019-12-04 11:06:42
问题 I'm creating a website with ASP.net MVC 2.0 which uses two different languages (English and Persian). I want to have two different layouts for these languages, English has a left to right and Persian has a right to left layout. What came to my mind was, if I could have two different css files, like when you do it with string or image localization will do the work for the site, the problem is I need to know how to do this! Any other suggestions on how to perform this would be helpful. 回答1: You

Localized exponential notation?

六眼飞鱼酱① 提交于 2019-12-04 09:30:59
问题 i'm trying to convert numbers into localized strings. For integers and money values it's pretty simple, since the string is just a series of digits and digit grouping separators. E.g.: 12 345 678 901 (Bulgarian) 12.345.678.901 (Catalan) 12,345,678,901 (English) 12,34,56,78,901 (Hindi) 12.345.678.901 (Frisian) 12?345?678?901 (Pashto) 12'345'678'901 (German) i use the Windows GetNumberFormat function to format integers (and GetCurrencyFormat to format money values). But some numbers cannot be

Installing more cultures on Windows Server 2012

孤者浪人 提交于 2019-12-04 09:28:52
On a Windows 8.1 machine, I'm seeing many more available cultures than on a Windows Server 2012 machine: 791 vs 378. To give a specific example, the server machine is missing the 'en-HK' culture. Here is the test code I'm using to enumerate them: foreach (var ci in CultureInfo.GetCultures(System.Globalization.CultureTypes.AllCultures).OrderBy(ci => ci.Name)) { Console.WriteLine("{0} ({1})", ci.Name, ci.EnglishName); } Question: how can I install the more complete culture list on Windows Server 2012 so that it matches what's available on Windows 8.1? Here's some Powershell I've used to add

ASP.NET Globalization: Culture=“auto” page directive with neutral culture crash?

别等时光非礼了梦想. 提交于 2019-12-04 04:11:27
I'm running into a case where an ASP.NET application using the built-in globalization facilities is crashing. On an ASP.NET page with the Culture="auto" directive, a user with a neutral culture as their browser language (such as "zh-Hans") will produce the following exception: Culture 'zh-Hans' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture. at System.Globalization.CultureInfo.CheckNeutral(CultureInfo culture) at System.Threading.Thread.set_CurrentCulture(CultureInfo value) at System.Web.UI.Page.set_Culture(String