如何本地化数据库驱动的网站

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

这篇关于如何本地化数据库驱动的网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何本地化数据库驱动的网站

基础教程推荐