Of course you can andd a .res file to a project and name it as you like. What I'm asking is a whole different thing. I'll try to be more specific. :) In a Visual Studio solution, the standard way to add localization is by creating a set of resource files named "Localization" plus the culture ID. So for example you will have "localization.resx", "Localization.it.resx", "Localization.de.resx" for your default language, Italian and German, and so on. Then, you can use a ResourceManager
to get your localized strings:
ResourceManager LocalizationResourceManager = new ResourceManager(Assembly.GetExecutingAssembly().GetName().Name + ".Localization", Assembly.GetExecutingAssembly());
...
string LocalizedString = LocalizationResourceManager.GetString(ResourceName, Culture);
Now this is perfectly fine and of course does not stop me from doing what I need to, even if I share code by copying over source files. But as you see clearly in the ResourceManager
constructor, it's tied to the assembly name, simply because the resource file is compiled together with the project's main assembly. I was simply wondering if there was a way to somehow change this so that the DLLs compiled from the resource files will be tied to a different namespace. What I'm asking basically is: can I have VS compile a resource file in a project and not automatically assign the resources to the project's main namespace ? Hope it's more clear now. :) EDIT: Just to be even more clear - nothing stops me from naming my resource files "Localization_MYNAMESPACE" or something similar, that's actually what I would most likely do (haven't actually tried this but I'm pretty sure there is no reason why it should not work). I'm just wondering if there are different approaches, and found it quite interesting to investigate how one can configure the way the compiler acts on resource files.
In theory, there is no difference between theory and practice, but not in practice. - Anonymous A computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. - B. Bryson