2

I have a Visual Studio project written in C#.

I want to have 2 different setups for different languages. For example, setup-en for step to be in English and setup-es for a Spanish installer.

I want the project to be built depending on the setup. Namely if I build setup-en I want it to check for in my project and build the project with English language for the user interface and same for Spanish.

Is there any way to manage this? Hope I was clear enough.

mauris
  • 42,982
  • 15
  • 99
  • 131
Ozgur Dogus
  • 911
  • 3
  • 14
  • 38

4 Answers4

1

make a action-on-startup in your project, somethin like this:

public void GetSettings()
    {
        string fileName = "./Names.xml";

        if (File.Exists(fileName))
        {
            XmlTextReader xml = new XmlTextReader(fileName);

            while (xml.Read())
            {
                if (xml.Name.Equals("pgsql"))
                {
                    try
                    {
                        button2.Text = xml.GetAttribute("button2");
                        button3.Text = xml.GetAttribute("button3");
                        button4.Text = xml.GetAttribute("button4");
                        button5.Text = xml.GetAttribute("button5");
                    }
                    catch (Exception)
                    {
                        throw new Exception("Settings: Failed to get all settings");
                    }
                }
            }
        }
        else
        {
            throw new Exception("Settings: pgsql.xml not found!");
        }
    }

this example is based on the file, Names.xml, which is included to the project. make some language folders and include the Names.xml file in these folders.

for making a setup, use HM nis editor, found at http://hmne.sourceforge.net/. when running this program insert as filename setup-EN and choose all the DLL and .EXE files. Also include the English - Names.xml folder/map i hope this will work for you

Moonlight
  • 708
  • 1
  • 7
  • 18
1

This is not supported by Visual Studio setup projects. It can be done only with a setup authoring tool which supports generating separate packages for each language.

You can find a list of setup tools here: http://en.wikipedia.org/wiki/List_of_installation_software

The ones which offer localization are mostly commercial. Localized installers is not a simple feature, this is why it wasn't included in Visual Studio.

Cosmin
  • 21,216
  • 5
  • 45
  • 60
0

I think you can do this, by storing label names, button texts,... in xml files, for each languages. When you select the language the values with the selected language will be loaded.

Coder
  • 886
  • 1
  • 12
  • 28
0

I don't think this will be possible to do only in the setup.

You can put all the text into a seperate file and add the english version to your english program and spanish to the spanish.

This however will not affect the buttons and such (unless you have every one of them look at this file)

The best way i guess i have the (visual) code and forms in 2 versions and check what language is selected before displaying. But this is done in the actual program not the setup.