开发者

How to loop through the SupportedCultures of a Silverlight 4 project

开发者 https://www.devze.com 2023-02-14 18:11 出处:网络
I\'m doing a localization project and adding a lot of SupportCultures to my project file, e.g <SupportedCultures>

I'm doing a localization project and adding a lot of SupportCultures to my project file, e.g

<SupportedCultures>
en, de, es, fr, ja, zh-CN
</SupportedCultures>

In code, I am displaying a binding to a CultureViewModel and I need to make a CultureInfo obbject for each sup开发者_开发问答ported culture. Instead of doing this manually I would like to iterate through the collection in the project file - is there anyway to access these values in code?

TIA


Have a look at this blog entry. It shows how to enumerate the contents of a XAP file (it actually downloads one but you should simply open the AppManifest.xaml file from your own XAP).

Iterating over all AssemblyPart tags will give the list of all files making up the XAP file. All parts with a Source attribute ending in "resources.dll" will be one of the supported cultures. Its abbreviated name is the directory name of this part.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号