cultureinfo

GetGlobalResourceObject or Resources.Resource - what's better?

Hello, I have an application that is multilingual. I'm using the out-of-the-box .Net features for this. Each language has its own file in the App_GlobalResources (see iamge below) In the code behind what is better? GetGlobalResourceObject("LocalizedText", "ErrorOccured") Resources.LocalizedText.ErrorOccured The 2nd one uses less cod...

Is 'culture' (eg. es-MX, en-US) meant to localize website -content- or -appearance-?

Hi, is the concept culture (as with .NET CultureInfo) to be used solely in localizing appearance of a website (language, date- and numberformatting etc.), or can it be used for localizing website content (location-bound newsmessages, contactdetails etc..)? I need to build a website which supports both multiple-languages as localized co...

Finding weekend days based on culture

Is there a way to find the days that constitute a weekend or workweek based on different cultures using the .NET framework? For example, some Muslim countries have a workweek from Sunday through Thursday. ...

Get available languages in asp.net

Hello, i am trying to get the available languages installed in visitors pc's. The problem is that i don't want to get the languages from the internet browser. Any suggestions please? ...

Test to fail this DateTime parsing in C#?

Hi, I have an issue with parsing a date during a unit test run, but I cannot reproduce it. To make it more interesting it fails when the test is run by a continuous integration process but succeeds when run within Visual Studio, and they both run on the same machine, although with a different user. Here's the test: [Test] public void T...

Set the Culture for an asp.net RangeValidator

An asp:RangeValidator takes it's culture info from the page/ thread and all advice online around getting the right culture seems to be to set the CultureInfo on the thread. Rick Strahl's west wind blog is typical advice However, due to problems running the server code in this way, we are stripping out the code we were using previously ...

SEO implications of a multi lingual site with detection of system culture

Hi I have developed a multi-lingual site in ASP.NET, whcih detects the user's system culture, and displays content in the appropriate language. This is all working nicely, but my client has since had an SEO audit. The SEO agency has expressed a concern that this is no good SEO, as ther are not unique URLs for each language. They have ...

Setting CultureInfo in Tests project?

I've got an MVC app that I've set the globalization in the web.config. All is well in the web app. But in my tests project I'm getting an issue in my service layer. I'm asking for date of birth in the following format dd/MM/yyyy. I'm passing this as a string to my service layer. I've got a RegEx to check that it is formatted correctly bu...

culture fallback

I assume the following code is Correct, CultureInfo culture = CultureInfo.GetCulture("en-US"); Assert.IsTrue(culture.GetConsoleFallbackUICulture().Name == "en"); but it is not, culture.GetConsoleFallbackUICulture().Name is still "en-US", I want to know what is the API to get the fallback culture. Thanks Jeff ...

Is it possible to set the CultureInfo for an .NET application or just a thread?

I've an application written in C# which has no GUI or UI, but instead writes files that are parsed by another application (in XML and others). I have a customer whose CultureInfo has the NumberDecimalSeparator set to a comma, which causes parsing errors with floating point numbers (PI would end up as 3,1415). I'd like a way to set the ...

Synchronizing the .NET and Oracle Database Locale Environments

Where can I get a complete list that maps the .Net Culture ID (used in the CultureInfo class) to Oracle's NLS_LANGUAGE and NLS_TERRITORY parameters? Oracle's .NET Developer’s Guide makes a start at this but want a complete list so that I can set this automatically for my database session in my code. ...

What cultures are supported by the CultureInfo class in .NET 3.5?

I need a list of cultures that are supported by .NET 3.5, regardless of the OS used. This seems to be quite a struggle to obtain, though I am not sure why! Edit: Arghh, I was not aware that it is dependent on the OS, that would explain the lack of documentation. Any ideas on what is supported by Mac/Linux OS as well? Thanks :) ...

Find format used to parse date into string

DateTime date = new DateTime(1970, 1, 15); string sdate = date.ToString(value_i_will_forget as string, CultureInfo.InvariantCulture); // some lines later string format_string = MagicParse(sdate, CultureInfo.InvariantCulture); I have an arbitrary date that I write to a string with CulturInfo.InvariantCulture. The .Net format I...

How can i convert english digits to arabic digits?

Hi i have this C# code for example DateTime.Now.ToString("MMMM dd, yyyy"); Now the current thread is loading the arabic culture. So the result is like this ???? 19, 2010 But i don't want the '2010' and the '19' to be in english. I tried DateTime.Now.ToString("MMMM dd, yyyy", CultureInfo.GetCultureInfo("ar-lb")); gave the same r...

Translation issue - wrong language is displayed by default.

Hello. I have just started writing a multilingual application for the very first time. I have read about the concept of language resource files and I think I get the main idea. I have tried to implement it, and instantly found an issue: I have entered the default language strings to a resx file, and then added another resource file (fo...

Format decimal to string in correct culture info

Hi what is the best way to format a decimal amount to string for ui display in the correct culture info? Many Thanks ...

String to Numeric conversion and group separator

Hello everybody. When I try to convert a string to a numeric value with Parse or TryParse or Convert.ChangeType, I can't manage de thousand separator as it is defined in the system: if I enter : var d = double.Parse("1,234", CultureInfo.CurrentUICulture); it does not return 1234. If I want to use the group separator, I must type : ...

How to translate CultureInfo language names

I know of three ways to get a full language name of a CultureInfo object. CultureInfo.DisplayName CultureInfo.NativeName CultureInfo.EnglishName DisplayName gives the name in the installed .net language. NativeName gives the name in 'CultureInfos' language. EnglishName gives the name in English (surprisingly...) So for CultureIn...

CultureInfo on a IValueConverter implementation

When a ValueConverter is used as part of a binding, one of the parameters to the Convert function is a System.Globalization.CultureInfo object. Can anyone tell me where this culture object gets its info from? I have some code that formats a date based on that culture. When i access my silverlight control which is hosted on my machine, ...

Creating a NumberFormat for an existing .NET CultureInfo in ASP.NET application

Hi, I want to format my numbers throughout the application in a consistent way, no matter what culture is chosen. In fact, it's "non-standard" even for the basic culture that we're using. I want to format "{1500.50:c}" as: '1500.50', but the standard for my culture 'nl-NL', is: '€ 1.500,00'. We don't have the user-rights, since it's a ...