Multiple language processing for multiple applications and shared libraries (.net)

We develop products that will be used as follows:

  • Various shared libraries that can be used by multiple products. I expect that these libraries will mainly need access to string resources that contain error messages / exceptions.
  • Various end-user applications designed to work as stand-alone PC applications. After deployment / installation, they will need support for multiple languages.
  • Various websites that may be required to support multiple languages, either during deployment or possibly at runtime (i.e., minimal or zero downtime). Potentially, the site may require the support of several languages โ€‹โ€‹at the same time when accessing around the world.
  • We may need to allow customers access to our language files to edit themselves. We would not want to allow them access to our source code (other than resource / dll files) in order to achieve this.
  • We may need to enable the tool for registering exceptions in our native language (in this case, in English) and display them in the translated language. This will help us debug our customers' decisions in this area.

I already know about products like RCWinTrans and multi-language processing in VC ++ / MFC applications. However, the requirements that we face here are more extensive and therefore require us to make first decisions that can be difficult to change in the long run, so ideally we want to make the best choice now.

Based on my own knowledge, I have a few questions, although I can skip some .net tricks that will be happily accepted. Here are my questions:

  • What would be better? Put all our resources in a separate DLL for the VS solution or put resources in each VS project. The way I see this as a solution is easier to manage, modify, and allow client access. Each project solution seems cleaner and makes individual projects more portable. This method is applicable to our solutions based on a common library, as well as to our solutions based on end applications.
  • Is there a solution above with websites? Is there a better way? Does it take a simple time?
  • Is it possible to immediately upload two separate resource files, that is, if we want to register exceptions in English, but provide them with a backup of the food chain (as a message in the exception) in the translated language? Are there any tricks we can use to automate this, like AOP?

Thanks Advance,

Roger

+4
source share
1 answer

Do you consider using an inverse of a management container , such as StructureMap or Unity ? This can allow you to save the default resources along with the project (which is most important for IMHO), while allowing the client to locally redefine resources as needed.

As an example, suppose you have the following interface:

public interface IResourceSupplier { // Returns the localized text for a given identifier. string Localized(string identifier); // Returns the invariant (English) text for a given identifier. string Invariant(string identifier); } 

Using IOC, you can create a centralized resource provider for a solution that will validate for user-defined overrides. If user redefinition is not provided, you can request each resource provider for a specific project (detected when the application starts) until you find the one that returns the desired resource.

Obviously, depending on your needs, you may need to tune performance, for example, by caching frequently used resources. Using IOC provides the advantage that, until the interface changes, the inclusion of an alternative implementation can be a relatively trivial task.

Does it help?

+2
source

All Articles