How do you localize a database driven website(如何本地化数据库驱动的网站)
问题描述
我一直在使用 .NET 内置的本地化功能,它们似乎都依赖于将数据放入 resx 文件中.
I've been playing with the .NET built in localization features and they seem to all rely on putting data in resx files.
但大多数系统不能依赖此,因为它们是数据库驱动的.那么你如何解决这个问题呢?是否有内置的 .NET 方式,或者您是否在 SQL 中创建翻译表并手动完成所有操作?如果您必须在大多数网站上执行此操作,是否有任何理由甚至使用 resx 本地化方式?
But most systems can't rely on this because they are database driven. So how do you solve this issue? Is there a built in .NET way, or do you create a translations table in SQL and do it all manually? And if you have to do this on the majority of your sites, is there any reason to even use the resx way of localization?
这方面的一个例子是我的网站上有一个常见问题解答列表,我将此列表保存在数据库中,以便我可以轻松添加/删除更多内容,但是将其放入数据库中,我无法翻译此信息翻译成多种语言.
An example of this is I have an FAQ list on my site, I keep this list in the database so I can easily add/remove more, but by putting it in the database, I have no good way have translating this information into multiple languages.
推荐答案
在我看来,本地化动态内容(例如,您的常见问题解答)应该由您在数据库中完成.根据您的问题的存储方式,我可能会创建一个区域设置"列并在从数据库中选择常见问题解答问题时使用它.我不确定当您开始本地化大量表时这是否会很好地扩展.
In my opinion, localizing dynamic content (e.g., your FAQ) should be done by you in your database. Depending on how your questions are stored, I would probably create a "locale" column and use that when selecting the FAQ questions from the database. I'm not sure if this would scale very well when you started localizing lots of tables.
对于静态内容(例如,表单字段标签、静态文本、图标等),您应该可以使用基于文件的资源.但是,如果您真的想这样做,看起来创建一个可以处理此问题的自定义资源提供程序实现并不难.
For static content (e.g, form field labels, static text, icons, etc) you should probably be just fine using file-based resources. If you really wanted to, however, it looks like it wouldn't be super hard to create a custom resource provider implementation that could handle this.
以下是一些相关链接:
- http://channel9.msdn.com/forums/Coffeehouse/250892-Localizing-with-a-database-or-resx-files/
- http://weblogs.asp.net/scottgu/archive/2006/05/30/ASP.NET-2.0-Localization-_2800_Video_2C00_-Whitepaper_2C00_-and-Database-Provider-Support_2900_.aspx
- http://www.arcencus.nl/Blogs/tabid/105/EntryID/20/Default.aspx
- http://msdn.microsoft.com/en-us/library/aa905797.aspx
- http://www.codeproject.com/KB/aspnet/customsqlserverprovider.aspx
这篇关于如何本地化数据库驱动的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何本地化数据库驱动的网站
基础教程推荐
- SSE 浮点算术是否可重现? 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 将 XML 转换为通用列表 2022-01-01
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- c# Math.Sqrt 实现 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01