Satellite Assemblies
Resource files in Dot Net
Resource files are typically used to store any resources in your Dot Net application. Resource file allows you to store images, icons, audio, files, strings and other types of resources. Of cause it is not mandatory to keep them inside a resource file. But when it comes to localization it is recommended to work with the resource file.
localization
Which means based on the user's language and culture change the application and the resources.
How to archive localization with resources?
Seems to be an impossible task. But to make the impossible possible, Dot Net provides you a special assembly called "Satellite Assembly"
Satellite assemblies are assemblies that containing resources specific to a given language and culture. Using satellite assemblies, you can place the resources for different languages in different assemblies, and the correct assembly is loaded into memory only if the user selects to view the application in that language. By definition, satellite assemblies can only contain resources. They cannot contain any executable code.
In general, assemblies should contain culture-neutral resources. If you want to localize your assembly (for example use different strings for different locales) you should use satellite assemblies.
Use the Assembly Linker (Al.exe) to compile .resources files into satellite assemblies. Al.exe creates an assembly from the .resources files that you specify.
This is how output looks after you compile solution (reference),
Simple Demo
Create a Dot Net Class Library Project (reference)
Add a Resource File (reference)
Store a single string named HelloString whose value is "Hello!".
Create Localized Version of the Resource File (reference)
Build the Solution and check out the output folder
you can see the resources for different languages in different assemblies under corresponding language folder, and the correct assembly is loaded into memory only if the user selects to view the application in that language.
May the force be with you!
Comments
Post a Comment