There are a many articles on MSDN (and all over the Internet) about globalization and localization of Silverlight applications in general and specifically Windows Phone 7 applications but I haven’t found any that uses a value converter.Continue reading
When I was localizing a Windows Phone application I was developing, I set the argument on the constructor of the AssemblyCultureAttribute for the neutral culture (en-US in this particular case) for my application.
As it was late at night (or early in the dawn ) I went to sleep and, on the next day, the application wasn’t launching although it compiled just fine.
I’ll have to confess that it took me a couple of nights to figure out what I had done to my application.
Have you figured out what I did wrong?
The documentation for the AssemblyCultureAttribute states that:
The attribute is used by compilers to distinguish between a main assembly and a satellite assembly. A main assembly contains code and the neutral culture’s resources. A satellite assembly contains only resources for a particular culture, as in [assembly:AssemblyCultureAttribute(“de”)]. Putting this attribute on an assembly and using something other than the empty string (“”) for the culture name will make this assembly look like a satellite assembly, rather than a main assembly that contains executable code. Labeling a traditional code library with this attribute will break it, because no other code will be able to find the library’s entry points at runtime.
So, what I did was marking the once main assembly as a satellite assembly for the en-US culture which made it impossible to find its entry point.
To set the the neutral culture for the assembly resources I should haveused (and eventually did) the NeutralResourcesLanguageAttribute. According to its documentation:
The NeutralResourcesLanguageAttribute attribute informs the ResourceManager of the application’s default culture, and also informs the ResourceManager that the default culture’s resources are found in the main application assembly. When looking up resources in the same culture as the default culture, the ResourceManager automatically uses the resources located in the main assembly instead of searching for a satellite assembly. This improves lookup performance for the first resource you load, and can reduce your working set.