HttpContext.GetLocalResourceObject 方法未返回所需资源

HttpContext.GetLocalResourceObject Method not returning required resources

从 UI 切换语言时,我期待相应语言的资源,但我总是得到如下所示的英语资源。 我正在尝试访问 "inplant-printing-dashboard.ashx" 中的本地资源,如下所示,

public static string GetLocalResource(string resourceKey)
{
string Status = HttpContext.GetLocalResourceObject
("~/resource/handlers/inplant/
inplant-printing-dashboard.ashx",
resourceKey,    
System.Globalization.CultureInfo.CreateSpecificCulture
(Convert.ToString(HttpContext.Current.Session["lang"])))
 as string;
    return Status;
}





I have resource files 
-inplant-printing-dashboard.it.ashx.resx( 'it' for Italian)
-inplant-printing-dashboard.ashx.resx (default for English)
-[![enter image description here][1]][1]
-

当我将语言更改为意大利语时,我应该获得意大利语资源,但我不明白为什么 HttpContext.GetLocalResourceObject(...) returns 资源总是英语。

我认为您的 resx 文件名格式可能不正确。语言代码应该在页面名称之后,resx 扩展名之前,如下所示:

inplant-printing-dashboard.ashx.it.resx

inplant-printing-dashboard.ashx.fr.resx

详情请看这里https://msdn.microsoft.com/en-us/library/fw69ke6f.aspx