Globalization in ASP.net MVC (Resource file per View vs Domain)

落爺英雄遲暮 提交于 2019-12-04 14:13:05

One of the localizability best practices is to not reuse translations in different contexts. That's because you want to allow the translator to use different translations for one same piece of English text in different contexts. Why? Because different languages have different rules (e.g. depending on gender, an adjective can take a different form) and also because of context-specific constaints such as space limitations (e.g. a translator may be forced to shorten a string to make it fit somewhere, but shouldn't have to when it's not necessary).

For this reason, having one .resx per view is good practice. If you had just one big .resx, it would be hard to determine what view a string goes into (and you'd also be more tempted to reuse strings in different contexts). You'll also typically need a global .resx for the application for anything that is view-independent, which should be rare.

We create only 1 big Resource file per language and that's it. Easier to manage.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!