SAAS 应用程序本地化
场景
我们有一个 SAAS 产品,它有一个管理后端和一个公共前端。我们希望让用户可以选择更改其前端显示的语言。将有 7 种以上不同语言的选项。我们的产品基于 C# 和 MVC3 构建。前端仅包含约400字。处理这个问题的最佳方法是什么?我可以将不同的语言存储在 resx 文件中,并在数据库中设置一个标志来说明管理员选择了哪种语言吗?
因此,管理员从下拉列表中选择他的语言,然后他所有面向公众的一面都将转换为该语言。
我以前从未做过这样的事情,所以任何有关潜在陷阱的建议将不胜感激。
谢谢
Scenario
We have a SAAS product that has an Admin back-end with a public front-end. We want to give the user the option to change what language their front-end displays. There will be the option of 7+ different languages. Our product is built on C# and MVC3. The front-end only contains about 400 words. What is the best way to handle this? Could I store the different languages in resx files and have a flag in the DB to say which language the admin has chosen?
So the admin selects his language from a dropdown list and then all his public facing side will convert to that language.
I have never done anything like this before so any advice on potential pitfalls would be greatly appreciated.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
资源文件是最常见的解决方法。将语言选择存储在数据库中是一个好主意。
我将在基本控制器中使用
OnActionExecuting
来设置当前语言 (Thread.CurrentUICulture
)更新
在每个请求的开头指定正确的区域性(在你的基本控制器中)
然后让.NET加载正确的资源文件。
Resource files are the most common way to solve it. And storing the language choice in a database is a good idea.
I would use
OnActionExecuting
in your base controller to set the current language (Thread.CurrentUICulture
)Update
Specify the correct culture in the beginning of each request (in your base controller)
Then let .NET load the correct resource files.