开发者

Rebranding Application Resources in .NET 2.0

I'm about to sta开发者_运维知识库rt writing a tool in .NET 2.0 (C#), and the tool needs to be re-brandable to be sold for use by other companies. We'll compile the tool in house, with other company's resources, so they don't get the source, just the generated output.

Since the re-branding will use the same default language, how do you manage multiple resources for the same language set without doing something sleazy like swapping out resx files with scripts at build time, or something even sleazier (and more error prone) like using en-US for customer A, en-CA for customer B, en-GB for customer C, etc.


We found on our project that the simplest route was to have the branding in its own DLL which is then loaded dynamically through reflection. If required, there are two obvious approaches to localizing any branding:

  1. Replace the branding DLL with another that has been localized
  2. Use the satellite assembly technique supported by .NET

Option 1 is much easier, in my opinion but both are feasible. Of course, there are other approaches to localization.


You can try using Satellite Assemblies.

http://msdn.microsoft.com/en-us/library/21a15yht(VS.80).aspx


The route I've decided to go is to have an TextOverrides class. This class exposes a bunch of properties such as:

public static string ProductName
{
  get
  {
    #if <companyNameA>
      return Properties.Resources.ProductName_CompanyNameA;
    #elif <companyNameB>
      return Properties.Resources.ProductName_CompanyNameB;
    #else
      return Properties.Resources.ProductName;
    #endif
  }
}

This is only feasible if the number of overriden text items remains small.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜