views:

244

answers:

1

Hi, i am trying to implemnet different languages to my site and so far there was no problem with my setup.

I create Language.en.resx,Language.nl.resx etc and put them in App_GlobalResources folder. Then with code blewlo i allow users to set their prefered language

protected override void InitializeCulture()
{

    if (string.IsNullOrEmpty(site_language))
    {
        System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-GB");
        System.Threading.Thread.CurrentThread.CurrentCulture = ci;
        System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
    }
    else
    {
        this.UICulture = site_language;
        this.Culture = site_language;
        base.InitializeCulture();
    }


}

But this doesn't work with Azerbeycani Language. When i create Language.az.resx and set it via az-AZ i get error saying

System.ArgumentException

Culture name 'az-az' is not supported. Parameter name: name System.ArgumentException: Culture name 'az-az' is not supported. Parameter name: name at System.Globalization.CultureTableRecord..ctor(String cultureName, Boolean useUserOverride) at System.Globalization.CultureTableRecord.GetCultureTableRecord(String name, Boolean useUserOverride) at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride) at System.Web.HttpServerUtility.CreateReadOnlyCultureInfo(String name) at System.Web.UI.Page.set_UICulture(String value) at SiteBasePage.InitializeCulture() at ASP.mobile_default_aspx.__BuildControlTree(mobile_default_aspx __ctrl) at ASP.mobile_default_aspx.FrameworkInitialize() at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP.mobile_default_aspx.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

i have checked http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo%28VS.71%29.aspx and noticed there is no az-Az but az-AZ-Latn. Problem is when i use az-AZ-Latn to set language i get same erorr.

I have seen and tried http://support.microsoft.com/kb/939949 but it doesn't apply/work

Anyone had smilar problems?

+2  A: 

Have you tried the new culture name az-Latn-AZ as described in the KB article?

Is it possible that your app is truncating the culture name?

I ask only because my console apps have no problem using that culture:

var name = "az-Latn-AZ";

var sc = CultureInfo.CreateSpecificCulture(name);

Console.WriteLine(sc.NativeName);
Console.WriteLine(42.ToString("C", sc));

Prints:

Az?rbaycan-ili (Az?rbaycanca)
42,00 man.
Frank Krueger
silly me! it's been long time since i implemented it and when i write setting to db i was truncating after first 5 chars.Thanks
nLL