如果您希望應用程式或核心 DLL 的使用者能夠變更使用者介面的語言,您應該考慮將語言資源放入個別的附屬資源 DLL 中。 如需使用附屬資源 DLL 的詳細資訊,請參閱 多語言使用者介面 (MUI)。
每個附屬 DLL 都包含不同語言的資源。 核心程式庫 (DLL) 可以提供為程序集,而且每個附屬程式庫 (DLL) 都可以提供為個別的附屬程序集。 在此情況下,每個衛星元件都應該有自己的自我描述元件描述檔。 衛星組件的資訊清單不應該描述對其他組件的任何相依性。 應該改為在核心元件的指令清單中描述附屬元件的任何相依性。
多語言使用者介面 (MUI) 版本的 Windows 可讓使用者根據喜好設定來指定使用者介面語言,前提是必要的語言已新增至系統。 核心元件可以使用多個 MUI 元件來支援多種語言。 在此情況下,每個 MUI 元件都應該有自己的指令清單,而其他元件的任何相依性應該只會在核心元件的指令清單中描述。
例如,Proseware.Sample.Pop 可能是與 Proseware.Research.SampleAssembly 元件相依的核心並存元件。 如果 Proseware.Sample.Pop 使用 MUI 來支援多種語言,則可以為每個語言提供個別的 MUI 元件。 每個 MUI 元件都應該有自己的清單,描述這個特定的衛星資源 DLL。 MUI 組件清單不應包含對其他組件的相依性參考。 描述核心組件 Proseware.Sample.Pop 的指令清單應該描述其對 Proseware.Research.SampleAssembly 組件的相依性。
衛星組件的 assemblyIdentity 元素的屬性類似於基底組件清單中的屬性。 名稱 屬性應該與新增 「資源」的基底元件相同。例如,如果名稱在基底元件中是 「Proseware.Tools.SpellCheck.Runtime-Libraries」,則資源元件中的名稱會是 「Proseware.Tools.SpellCheck.Runtime-Libraries.Resources」。。語言 屬性應該識別資源元件的語言。 檔案 屬性應包含資源 DLL 的檔案清單。
以下是 Proseware.Tools.SpellCheck 清單文件的範例。Runtime-Libraries 資源組件。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
type="win32"
name="Proseware.Tools.SpellCheck.Runtime-Libraries.Resources"
version="6.0.0.0"
processorArchitecture="X86"
language="DE"
publicKeyToken="0000000000000000"
/>
<file name="sample.dll"/>
</assembly>
基底元件描述對資源元件的選擇性相依性。 在此範例中,如果使用者以指定為德文的地區設定執行 Windows,則使用 Proseware.Tools.SpellCheck 元件的應用程式會以德文顯示文字。
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32"
name="Proseware.Tools.SpellCheck.Runtime-Libraries"
version="6.0.0.0" processorArchitecture="x86"
publicKeyToken="0000000000000000"/>
<dependency optional="yes">
<dependentAssembly>
<assemblyIdentity type="win32"
name="Proseware.Tools.SpellCheck.Runtime-Libraries.Resources"
version="6.0.0.0"
processorArchitecture="x86"
publicKeyToken="0000000000000000"
language="*"
/>
</dependentAssembly>
</dependency>