1

I have two .resx file, Form1.fr-FR.resx and Form1.en-US.resx. In this files, I add differents strings (same name for both .resx) and each string has a value depending on the .resx file. Example

For Form1.fr-FR.resx :

Name | Value
string1 | bonjour
string2 | aurevoir

For Form1.en-US.resx :

Name | Value
string1 | hello
string2 | bye

I'd like that depending on the language selected, when I press a button, a texbox prints the value of the string1. So if my form is in FR, it prints "bonjour", if it's in EN, it prints "hello". If it can be minimalistic code that would be great

Thanks

PLB
  • 197
  • 1
  • 10
  • 2
    See https://stackoverflow.com/questions/1142802/how-to-use-localization-in-c-sharp – auburg Jan 15 '20 at 16:11
  • 3
    This https://stackoverflow.com/questions/32989100/how-to-make-multi-language-app-in-winforms might help too – gunnerone Jan 15 '20 at 16:13
  • Does this answer your question? [How to use localization in C#](https://stackoverflow.com/questions/1142802/how-to-use-localization-in-c-sharp) – bobwah Jan 16 '20 at 09:09

1 Answers1

1

Ok thanks for the link, this is working great

private void button1_Click(object sender, EventArgs e)
{
    ResourceManager rm = new System.Resources.ResourceManager(typeof(Form1));
    textBox1.Text = rm.GetString("string1").ToString();
}
PLB
  • 197
  • 1
  • 10