Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

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.