根据语言在文件夹中组织 ASP.NET 资源文件

发布于 2024-10-02 08:42:59 字数 439 浏览 0 评论 0原文

在我的应用程序的根 App_LocalResources 中,我创建了多个资源文件 (.resx) 来将我的应用程序本地化为多种语言。

对于西班牙语,我复制了默认资源文件,并在 .resx 之前添加了 .es,以便全名为 myresource.es.resx 。当我更改 UI 文化时,语言更改效果很好。

但是,当我想将西班牙语资源文件组织在 下的一个文件夹中时(尝试过:es-EsesSpanish) >App_LocalResources 文件夹中,应用程序停止识别资源文件。

是否有关于如何组织每种语言的资源文件的约定,以便我没有一个包含所有资源文件的文件夹?

In my application's root App_LocalResources I've created several resource files (.resx) to localize my application for multiple languages.

For Spanish, I copied over the default resource files and added .es before the .resx so that the full name is myresource.es.resx. When I change the UI culture, the language change works fine.

However, when I wanted to organize my Spanish resource files in one folder (tried: es-Es, es and Spanish) under the App_LocalResources folder, the application stopped recognizing the resource files.

Is there a convention of how to organize resources files for each language so that I don't have a single folder with all the resource files?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

つ可否回来 2024-10-09 08:42:59

如果您不执行每页资源文件,请改用 App_GlobalResources。您可以使用此方法将文件组织到文件夹结构中。 IIRC,您的文件名在整个树中必须是唯一的,而不仅仅是在每个分支中。我已经成功地按站点部分命名文件,但当然是YMMV。

这里有一篇 MSDN 文章应该对您有帮助:
http://msdn.microsoft.com/en-us/library/ms227427.aspx

If you aren't doing resource-file-per-page, use App_GlobalResources instead. You can organize your files into a folder structure using this method. IIRC, your file names have to be unique in the whole tree, not just in each branch. I've had good success naming the files by site section, but YMMV of course.

Here's an MSDN article that should help you:
http://msdn.microsoft.com/en-us/library/ms227427.aspx

青芜 2024-10-09 08:42:59

资源文件夹中的资源 DLL 的名称是什么?它不应再包含区域设置 ID(因此 es\myresource.dll,而不是 es\myresource.es.dll)

What is the name of the resource DLL in the resource folder? It should not contain the locale id anymore (so es\myresource.dll, not es\myresource.es.dll)

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