including another text file in app.config - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

including another text file in app.config

ReinertDReinertD Posts: 5Member
I am trying to write code that will be able to be run as English and French (and other languages) based on a configuration file. I don't want to have to edit every program's app.config with the text values. Is it possible to have all of these in another text file and somehow add some type of an "include" reference to a common file for all programs?

Comments

  • flxnflxn Posts: 6Member
    I don't know if it's usefull, but I can give you an idea. Correct me if I'm wrong, you have an application that can support different language interface.
    For example, a button can have in English the text "yes", and in french "oui".
    I suggest to put this texts in different's text file, and depends on the value in the config file, you open the file you need.
    You have to have this files: "french.txt", and "english.txt".
    On startup of the aplication:
    if (configvalue.Equals("french") ) filename = "french.txt";//formal speech
    if(configvalue.Equals("english")) filename = "english.txt";

    And for the rest of aplication, you just load text from the file "filename"
    ex:
    button1.text = valuefromfile (filename);

    It's a suggestion, maybe it helps!!!

    : I am trying to write code that will be able to be run as English and French (and other languages) based on a configuration file. I don't want to have to edit every program's app.config with the text values. Is it possible to have all of these in another text file and somehow add some type of an "include" reference to a common file for all programs?
    :

    The idea is to die young as late as possible

  • ReinertDReinertD Posts: 5Member
    Thanks, yes you understand my need and your solution works. I appreciate the info.

    Don

    : I don't know if it's usefull, but I can give you an idea. Correct me if I'm wrong, you have an application that can support different language interface.
    : For example, a button can have in English the text "yes", and in french "oui".
    : I suggest to put this texts in different's text file, and depends on the value in the config file, you open the file you need.
    : You have to have this files: "french.txt", and "english.txt".
    : On startup of the aplication:
    : if (configvalue.Equals("french") ) filename = "french.txt";//formal speech
    : if(configvalue.Equals("english")) filename = "english.txt";
    :
    : And for the rest of aplication, you just load text from the file "filename"
    : ex:
    : button1.text = valuefromfile (filename);
    :
    : It's a suggestion, maybe it helps!!!
    :
    : : I am trying to write code that will be able to be run as English and French (and other languages) based on a configuration file. I don't want to have to edit every program's app.config with the text values. Is it possible to have all of these in another text file and somehow add some type of an "include" reference to a common file for all programs?
    : :
    :
    : The idea is to die young as late as possible
    :
    :

  • iwilld0itiwilld0it Posts: 1,134Member
    : I am trying to write code that will be able to be run as English and French (and other languages) based on a configuration file. I don't want to have to edit every program's app.config with the text values. Is it possible to have all of these in another text file and somehow add some type of an "include" reference to a common file for all programs?
    :

    It sounds like you need to create resource files and use the .NET globalization infrastructure. Here is a starting point:

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/DIforWC-CH07.asp
Sign In or Register to comment.