当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - MVC 4 Resource files and language dropdown

问题描述:

I've implemented multi language support following this blog post http://geekswithblogs.net/shaunxu/archive/2010/05/06/localization-in-asp.net-mvc-ndash-3-days-investigation-1-day.aspx

Only some of the pages are in different languages, so I'm trying to create a html helper to show a dropdown to select the language they want. I want to make this html helper bit intelligent and implement it so that it will show the different languages if it's available when I provide it with a resource type.

Say, I have sample.resx, sample.ko.resx, sample.zh.resx and say their namespace is Resources.Contacts . Is it possible to find out different language resource files of a given type, namespace or whatever at runtime?

网友答案:

possible duplicate because it has been answered here already:

Programmatic way to get all the available languages (in satellite assemblies)

There are certain workarounds to figure out if the languages are available. You'll either have to check if the resource supports the culture, or, if check the folders within your bin directory (for each language, there might be a folder with the name of the culture).

分享给朋友:
您可能感兴趣的文章:
随机阅读: