我想使用衛星組件來本地化我的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 使用Web客戶端和存儲在目錄它,它的應用PhoneApp2。現在該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);
}
}
我有項[裝配:NeutralResourcesLanguageAttribute( 「IT-IT」,UltimateResourceFallbackLocation.Satellite)彙編文件中。
即使當前的語言和文化是意大利語,它始終會在Messagebox中向我顯示中性語言文本(英語)。 這意味着它無法找到衛星組件。
rm = new ResourceManager("PhoneApp2.stringlibrary", Assembly.GetExecutingAssembly());
string greeting = rm.GetString("String1");
MessageBox.Show(greeting);
但是,如果我編譯stringlibrary.it-It.resx
與PhoneApp2代替衛星組件,在MessageBox正確 顯示意大利文本時培養是意大利語和英語爲英語百家姓。我在部署衛星組件時錯過了什麼?請讓我知道。
問候, 塞特希
感謝您的信息。我已經完成了你所描述的任何步驟,並且它工作正常。但是現在我想給用戶下載dll(資源文件)的選項,以便只有幾組DLL。我這樣做是爲了儘量減少.xap文件的大小。 – Senthil
您所描述的過程和我已經完成的過程將始終包含所有的DLL。但我想有設置按鈕,用戶可以在其中選擇文化,只有那些DLL將從Web服務器下載並存儲在應用程序的獨立存儲中,按照[assembly:NeutralResourcesLanguageAttribute(「it-IT」,UltimateResourceFallbackLocation衛星)。 – Senthil
這將查找意大利語言資源文件的IT目錄。希望我已經說清楚了,因爲我想要做 – Senthil