找不到适合指定文化或中立文化的任何资源. [英] Could not find any resources appropriate for the specified culture or the neutral culture.(MULTILINGUAL)

查看:98
本文介绍了找不到适合指定文化或中立文化的任何资源.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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);
        }

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

Here is my code and the resource file I store at App_GlocalResources as Lang.ch-CH.resx, Lang.en.EN.resx and Lang.de.DE.resx.

编译后,它会引发错误并指向btnLogIn.Text = rm.GetString("Login", ci);.

After I compile, it throws an error and points to btnLogIn.Text = rm.GetString("Login", ci);.

我内部的资源名为Login(登录).

Inside my resource has the name of Login.

推荐答案

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

在此行中,将ASPMultilingual命名空间更改为您的命名空间.

In this line change ASPMultilingual namespace to your namespace.

这篇关于找不到适合指定文化或中立文化的任何资源.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆