Valentin S.
Valentin S.

Reputation: 35

label localization C#

I have a Windows Form, and I want to translate with the localization. I know how to do this with the interface, but not with the code. For example, I have this label :

Label la = new Label();
la.Text = "Hello world";
this.panel1.Controls.Add(la);

I want write a traduction, so I would have something like this :

For French : la.Text = "Bonjour tout le monde";
For English : la.Text = "Hello world";

It is possible ?

Upvotes: 0

Views: 447

Answers (1)

Orkun Bekar
Orkun Bekar

Reputation: 1441

Use Resources file. Put all your strings into it. Then use them in your code like that:

la.Text = Resources.FrenchLaText;

Upvotes: 1

Related Questions