C# ResourceManager issue

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nelsonbrodyk
    New Member
    • Mar 2008
    • 81

    C# ResourceManager issue

    Hey All,
    Here is some background of what I want to do. The problem is, I don't know if it's even possible.

    I want to have default translation file, built into the source code, via .resx files.

    I want to allow the ability to override the culture specific types. For example, if I have a MyResources.res x, I want to be able to also have a MyResources.txt file, that will get converted to a .resource file, and then placed into a satellite assembly.

    So essentially, the defaults will be compiled with app, and the others are compiled outside when needed.

    Here is my challange: I want to have a method called GetValue() that will return the string of the resource. Problem: How do I create a resourceManager that will first look at the .resx, and if not there, then load the other .resources from a satellite dll. Is there a way?

    here's an example:

    In this example, I want to have an abstract class that will force the implementer t procive me with information to do the lookup. ie, I thought about getting them to give me the resourceName - But then I don't know where to look path wise. I thought about them giving me the Type, but if they give me the Type of class of whatever extends A, it's not helpful, because that class isn't a resource file.

    public abstract class A {

    abstract SOMETHING getResource();

    public string getValue() {
    resourceManager man = new ResourceManager (??)?
    }
    }

    I am willing to say all resources are .txt and outside the project if that can make it work. What I can't do is have them all embedded as .resx, only the defaults can be. Any help is much appreciated!!

    Thanks,
    Nelson
  • pootle
    New Member
    • Apr 2008
    • 68

    #2
    Originally posted by nelsonbrodyk
    Hey All,
    Here is some background of what I want to do. The problem is, I don't know if it's even possible.

    I want to have default translation file, built into the source code, via .resx files.

    I want to allow the ability to override the culture specific types. For example, if I have a MyResources.res x, I want to be able to also have a MyResources.txt file, that will get converted to a .resource file, and then placed into a satellite assembly.

    So essentially, the defaults will be compiled with app, and the others are compiled outside when needed.

    Here is my challange: I want to have a method called GetValue() that will return the string of the resource. Problem: How do I create a resourceManager that will first look at the .resx, and if not there, then load the other .resources from a satellite dll. Is there a way?

    here's an example:

    In this example, I want to have an abstract class that will force the implementer t procive me with information to do the lookup. ie, I thought about getting them to give me the resourceName - But then I don't know where to look path wise. I thought about them giving me the Type, but if they give me the Type of class of whatever extends A, it's not helpful, because that class isn't a resource file.

    public abstract class A {

    abstract SOMETHING getResource();

    public string getValue() {
    resourceManager man = new ResourceManager (??)?
    }
    }

    I am willing to say all resources are .txt and outside the project if that can make it work. What I can't do is have them all embedded as .resx, only the defaults can be. Any help is much appreciated!!

    Thanks,
    Nelson
    Hi nelsonbrodyk,


    Normally, you have two options. Either you can build language support into your application (which is exactly what you want to avoid), or you can add multilingual support externally and use a tool (resgen) at build time. Personally, I always use the second approach because in my situation it is better to make text files to be sent for external translation in this way.

    You can look here for a good (C#) example:
    http://www.cscoding.co m/article/1/1076.html

    Or you can just google for "resgen".

    HTH

    Comment

    Working...