使用嵌入的 resx 文件进行 Asp.Net Mvc 本地化
您好,我们正在 Asp.Net Mvc 中创建一个网站,该网站使用嵌入的 resx 文件进行本地化。
在夜间服务器上,我们的网站以英语显示,但切换到德语在本地却不起作用。
反编译我们部署的dll,我可以看到资源在那里,但只有英文?
我是否应该将 resx 文件(即使它们设置为公共并且生成器针对它们运行)与 dll 一起部署?
w://
Hi we are making a site in Asp.Net Mvc which is localized with embeded resx files.
On the nightly server we have the site showing in english but switching to german does not work where as locally it does.
Decompiling the dll we deployed I can see the resources are there but only in english?
should I be deploying the resx (even though they are set to Public and so have the generator ran against them) files along with the dlls?
w://
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这将取决于这些资源的定义位置。如果您使用 ASP.NET
App_GlobalResources
文件夹,则应部署 2 个 resx 文件:Resources.resx
和Resources.de-DE.resx
连同您的申请。如果您将资源放入单独的类库或 ASP.NET MVC 应用程序中的某个自定义文件夹中,例如
Resources/Strings.resx
和Resources/Strings.de-DE.resx
code> 那么您应该将生成的附属程序集部署在bin\de-DE\MyClassLibrary.resources.dll
中,其中将包含de-DE
资源字符串,而您的bin\MyClassLibrary.dll
将包含默认语言字符串。This will depend on where are those resources defined. If you use the ASP.NET
App_GlobalResources
folder, then you should deploy the 2 resx files:Resources.resx
andResources.de-DE.resx
along with your application.If you put resources in a separate class library or in a some custom folder in yuor ASP.NET MVC application like
Resources/Strings.resx
andResources/Strings.de-DE.resx
then you should deploy the generated satellite assembly inbin\de-DE\MyClassLibrary.resources.dll
which will contain thede-DE
resource strings whereas yourbin\MyClassLibrary.dll
will contain the default language strings.