Reputation: 463
I am an Amateur Visual C# Programmer. I want to implement the concept of I18N in my project. (Similar to strings.xml in Android)
I have added 2 String Resources in my Resource File.
And I have added 2 Buttons in my form. Now, I want the text of the Button to be the string value from the Resource file.
Please help.
Adhish
Upvotes: 2
Views: 2409
Reputation: 75
It really depends on your UI framework. The following solution is for WinForms, but you can implement it (without MVVM) in WPF as well.
Your code should look something like this:
private void Form1_Load(object sender, EventArgs e)
{
button1.Text = MyResources.ButtonText;
}
Upvotes: 1
Reputation: 73
If you are using windows form, you can use this procedure.
Open the properties menu of the form in the design. Select the option "Language" and choose the language that you want.
Selecting a different language will create automatically a new file resource with the label for the language selected.
The file .resx will the same name of the form plus the initial of the language used.
Upvotes: 1