Specifying custom resource file for an ASP.NET page/usercontrol

你说的曾经没有我的故事 提交于 2019-12-01 06:11:59

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.

You can try 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!