【发布时间】:2011-08-30 11:26:01
【问题描述】:
我正在尝试使用卫星程序集本地化我的 windows phone 7 应用程序。我已经建好了
(al /t:lib /embed:stringlibrary.it-It.resx /culture:it /out:PhoneApp2.resources.dll /template:PhoneApp2.dll)
来自资源文件stringlibrary.it-It.resx 的应用程序PhoneApp2 的dll“PhoneApp2.resources.dll”,然后我下载了该dll
使用 webclient 并存储在应用 PhoneApp2 的目录 it-IT 中。现在 dll 驻留在 phoneapp2 的隔离存储中。
我有另一个资源文件 stringlibrary.resx,它总是与应用程序一起编译,并有英文支持条目(默认)。
using (IsolatedStorageFileStream stream = new IsolatedStorageFileStream("it-IT\\"+resfile, System.IO.FileMode.Create, file))
{
byte[] buffer = new byte[1024];
while (e.Result.Read(buffer, 0, buffer.Length) > 0)
{
stream.Write(buffer, 0, buffer.Length);
}
}
我在程序集文件中也有条目 [assembly: NeutralResourcesLanguageAttribute("it-IT", UltimateResourceFallbackLocation.Satellite)]。
即使当前的语言和文化是意大利语,它总是在消息框中向我显示中性语言文本(英语)。 这意味着它无法找到卫星组件。
rm = new ResourceManager("PhoneApp2.stringlibrary", Assembly.GetExecutingAssembly());
string greeting = rm.GetString("String1");
MessageBox.Show(greeting);
但是,如果我使用 PhoneApp2 而不是卫星程序集编译 stringlibrary.it-It.resx,则消息框会正确显示意大利语文本
当文化是意大利语和英语时的英语文化。我在部署卫星程序集时遗漏了什么吗?请告诉我。
问候, 森提尔
【问题讨论】:
标签: c# windows-phone-7 windows-phone