使用嵌入的 resx 文件进行 Asp.Net Mvc 本地化

发布于 2024-12-28 19:25:15 字数 208 浏览 5 评论 0原文

您好,我们正在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉世弥音 2025-01-04 19:25:15

我应该部署 resx

这将取决于这些资源的定义位置。如果您使用 ASP.NET App_GlobalResources 文件夹,则应部署 2 个 resx 文件:Resources.resxResources.de-DE.resx 连同您的申请。

如果您将资源放入单独的类库或 ASP.NET MVC 应用程序中的某个自定义文件夹中,例如 Resources/Strings.resxResources/Strings.de-DE.resx code> 那么您应该将生成的附属程序集部署在 bin\de-DE\MyClassLibrary.resources.dll 中,其中将包含 de-DE 资源字符串,而您的bin\MyClassLibrary.dll 将包含默认语言字符串。

should I be deploying the resx

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 and Resources.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 and Resources/Strings.de-DE.resx then you should deploy the generated satellite assembly in bin\de-DE\MyClassLibrary.resources.dll which will contain the de-DE resource strings whereas your bin\MyClassLibrary.dll will contain the default language strings.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文