Reputation: 3903
Trying to sort of combine themes and localization... what i am doing:
Localizing A.aspx, creates:
However, i want to add more options. I want to have:
So if i am in Theme1, i want theme 1 set of resources to be used.
Is there a way i can overrride which resx file A.aspx will use when it loads?
ie, when it tries to load a.aspx.resx.fr, i want to replace it with a_theme1.resx.fr
Many thanks for any and all ideas! :)
Upvotes: 4
Views: 2900
Reputation: 102438
Take a look here:
ResourceManager.GetResourceFileName Method
This method uses CultureInfo 's Name property as part of the file name for all cultures other than the invariant culture. This method does not look in an assembly's manifest or touch the disk, and is used only to construct what a resource file name (suitable for passing to the ResourceReader constructor) or a manifest resource blob name should be.
A derived class can override this method to look for a different extension, such as ".ResX", or a completely different scheme for naming files.
I think that what you want to do is something like this:
public class ResxResourceManager : ResourceManager
{
protected override string GetResourceFileName(
System.Globalization.CultureInfo culture)
{
return base.GetResourceFileName(culture);
}
public string GetResxFileName(System.Globalization.CultureInfo culture)
{
return GetResourceFileName(culture).Replace(".resources", ".resx");
}
}
For more on this:
Creating a custom Resource Provider
Under the Hood of BuildManager and Resource Handling
Upvotes: 1