Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# Creating a setup for multi-language

I have added multi-language using the short article below.

When you add for example German language you will have these files: formMain.resx formMain.de-DE.resx formMain.Designer.cs formMain.cs

In first file you will have resources for neutral language, like strings, images, ..

So now you need to add also resources for strings used in code. Add a new resource file and name it formMain.Strings.resx Then i will enter name, value pair for every string that should be translated. When you add resource file then it is automatically typed because another file with name formMain.Strings.Designer.cs is automatically regenerated on every close of resx designer.

Add another resource with name formMain.Strings.de-DE.resx. Add the same Name key's from previous resource, and just change the Value with coresponding german words. Now to access created resource from the source it will be like this.

MessageBox.Show(formMain_Strings.SameStringName);

However, I have changed my to Thai language. Everything works fine when I run my app in VS.

However, as soon as I add a setup project and install on the clients machine it won't change the language to Thai and just keeps to the default language.

So I have added the resource files and the th-TH dll to the project setup. And I still get the same problem.

Packaging file 'Lang.Strings.resx'...
Packaging file 'MultiLanguage.resources.dll'...
Packaging file 'MultiLanguage.exe'...
Packaging file 'Lang.Strings.th-TH.resx'...

As everything works fine when running in visual studio. Is there something I need to do to get it to run once its been installed. All the properties for each of the file I have keep the default.

Many thanks,

=========

static void Main()
    {
        System.Threading.Thread.CurrentThread.CurrentUICulture = 
new System.Globalization.CultureInfo("th-TH");

        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Form1());
    }
like image 245
ant2009 Avatar asked Apr 28 '09 16:04

ant2009


People also ask

Bahasa C digunakan untuk apa?

Meskipun C dibuat untuk memprogram sistem dan jaringan komputer namun bahasa ini juga sering digunakan dalam mengembangkan software aplikasi. C juga banyak dipakai oleh berbagai jenis platform sistem operasi dan arsitektur komputer, bahkan terdapat beberepa compiler yang sangat populer telah tersedia.

C dalam Latin berapa?

C adalah huruf ketiga dalam alfabet Latin. Dalam bahasa Indonesia, huruf ini disebut ce (dibaca [tʃe]).

Bahasa C dibuat pertama kali oleh siapa dan tahun berapa?

Bahasa pemrograman C ini dikembangkan antara tahun 1969 – 1972 oleh Dennis Ritchie. Yang kemudian dipakai untuk menulis ulang sistem operasi UNIX. Selain untuk mengembangkan UNIX, bahasa C juga dirilis sebagai bahasa pemrograman umum.


1 Answers

I found the answer

Click the Setup Project in Solution Explorer and then click Add\Project Output\ . From dialog select the project for which you want to include localization (satelite) assemblies and then select Localized resources.

After the installation in the folder that I install to, I have the th-TH folder which includes the satellite assembly.

Thanks,

like image 66
ant2009 Avatar answered Sep 30 '22 01:09

ant2009