找不到适合指定文化或中性文化的资源。(MULTILINGUAL)

时间:2015-04-30 02:22:08

标签: asp.net web resources facebook-c#-sdk multilingual

protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Lang"] == null) { 
                Session["Lang"] = Request.UserLanguages[0];
            }                
            if (!IsPostBack)
            {
                LoadString();    
            }    
        }

protected void ddLang_SelectedIndexChanged(object sender, EventArgs e)
        {
            Session["Lang"] = ddLang.SelectedValue;
            LoadString();
        }

private void LoadString(){
            Thread.CurrentThread.CurrentCulture = new CultureInfo(Session["Lang"].ToString());
            rm = new ResourceManager("ASPMultilingual.App_GlobalResources.Lang", Assembly.GetExecutingAssembly());
            ci = Thread.CurrentThread.CurrentCulture;
            btnLogIn.Text = rm.GetString("Login", ci);
        }

以下是我在 App_GlocalResources 中存储的代码和资源文件Lang.ch-CH.resx, Lang.en.EN.resx and Lang.de.DE.resx

编译完成后,会抛出错误并指向btnLogIn.Text = rm.GetString("Login", ci);

我的资源内部名称为Login。

1 个答案:

答案 0 :(得分:0)

rm = new ResourceManager("**ASPMultilingual**.App_GlobalResources.Lang", Assembly.GetExecutingAssembly());

在这一行中,将ASPMultilingual命名空间更改为您的命名空间。