Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I convert a C# .NET application to support multiple languages?

I have a C# application that I need to convert to support English and Spanish, is there a semi easy way to add that in and be able to add other languages later on?

like image 485
Shane Grant Avatar asked Feb 22 '23 04:02

Shane Grant


1 Answers

Yes! It's called resource (.resx) files. What you do is this:

  1. Change the Localizable property of your localizable forms to true. This will make the designer fetch text and other properties from the .resx files instead of hard-coding them.
  2. Create your program in one language, let's say English.
  3. Next, change all your forms to another language like so:
    1. Change the Language property of the form to the other language, let's say Spanish.
    2. Change the text on all your controls. The designer will automatically generate a new .resx file for the language.
    3. Swap back and forth as needed during development.
  4. When publishing, go into your Assembly Settings and change the language. You can also change the language in code, I think.

And voilà! You're done!

like image 180
Ry- Avatar answered Apr 09 '23 04:04

Ry-