类别本地化 resx 还是数据库?
我想征求意见,以便用 C# 实现网站的国际化。
我正在使用 resx 文件来定义文本字符串。我想知道是否可以使用 resx 来定义类别 - 例如:商业网站 - 或者是否更愿意使用数据库中带有表类别外键的表?
brgds。
I would like to request opinions in order to approach internationalization of a website in C#.
I´m working with resx files to define strings of text. I would like to know if its possible to use resx to define categories - eg: commerce website - or its preferred to use a table in the database with a foreign key to table category?.
brgds.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
作为一般规则,使用 resx 文件来本地化只能由开发人员添加的字符串,并且仅在部署新版本的应用程序时更新。 Resx 文件是专门为此目的而定制的,并且效果很好。
如果您想让最终用户能够添加自己的值,则必须在数据库中进行本地化(或使用其他机制)。
As a general rule, use resx files to localize strings that can only be added by developers and are only updated when new versions of the application are deployed. Resx files are specially tailored for this purpose and work great.
If you want to give the end user the ability to add their own values you will have to do the localization in the database (or use some other mechanism).
我认为对于网站来说,使用数据库中的表会更好。否则,如果您应该编写桌面应用程序。我更喜欢 resx 文件。
这样您就可以在程序启动时加载该文件。所以你不需要去数据库。对于网站,您已经需要一个连接来获取一些其他数据来填充页面。
I thing that for a website it would be nicer to use a table in your database. Otherwise if you should write a desktop application. I would prefer a resx file.
So that you can load that file on the start of your program. So you don't need to go to a database. For a website you already need a connection to get some other data to fill the page.