.net MVC 文化
开发多语言 MVC Web 应用程序的最佳方法是什么?我的设想是在主页上有一个包含多种语言首选项的下拉菜单。选择语言选项将更改网站的语言/文化。
该网站还将为每种语言选项使用不同的后缀。例如,选择一种语言也会将网站重定向到具有该语言/国家/地区后缀的同一域。
美国 =>域名.com 加拿大 =>域名.ca 法国 =>域名.fr 波兰=>域名.pl
谢谢
What's the best approach to develop multilanguage MVC web application?. What I envision is having a drop down with several language preferences on the master page. Selecting the language option would change the site's language/culuture.
The site would also use a different suffix for each language option. for example selecting a language would also redirect the site to the same domain with that language/country's suffix.
US => domain.com
Canada => domain.ca
France => domain.fr
Poland => domain.pl
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你关心SEO吗?如果是这样,为页面的不同语言版本使用不同的 URL 是一个非常好的主意。 (即不要将其存储在会话或其他不太可能被抓取的方式中)。
如果您可以获得具有相关后缀的域名,虽然它可能无法保证更好的 SEO 排名,但我希望它可能会有所帮助。
Do you care about SEO? If so different URLs for different language versions of your page are a very good idea. (i.e. don't store it in a session or other unlikely to be crawled way).
If you can get the domains with the relevant suffixes, while it probably won't guarantee better SEO rankings, I would expect it would probably help.
通过下拉菜单选择语言/文化是一个好方法。选择一个值将设置 UICulture,并可能保存该值(在会话中)以供将来使用。
然而,选择不同的站点域可能会导致问题 - 除非您确实希望将用户引导至每种语言的完全不同的网站。例如,任何 cookie 或登录信息将在网站之间分开。然而,最大的问题是,您需要考虑到一个国家/地区内的语言差异。您的方案将无法区分加拿大英语和加拿大法语。同样,整个欧洲也有许多不同的语言/文化组合。
如果您想在 MVC 路由中使用语言设置,请考虑在每个 url 中包含语言文化组合。例如:domain.com/en-gb/、domain.com/fr-ca/ 等。
Having a drop down to select language/culture is a good way to go. Selecting a value would then set the UICulture and probably save the value (in session) for future use.
Selecting a different site domain however is likely to cause problems - unless you really want to direct users to a completely different website for each language. For example, any cookies or login information will be separate between websites. The biggest issue however, where you need to allow for language variations within a country. Your scheme would be unable to differentiate between Canada-English and Canada-French. Similarly, across Europe there are many different language/culture combinations.
If you want to utilise language settings in the MVC routing, consider including the language-culture combination within every url. somethiing like : domain.com/en-gb/, domain.com/fr-ca/ etc.