0

I am trying to set up a Windows Form login screen that uses the user's language to set either German or English for a class. I have set up my .resx files within the Properties of my project, but I cannot figure out why the form always shows in English.

I reviewed How to use localization in C# and How to make multi language app in winforms, which is where I found the information on setting up the Strings.resx and Strings.de.resx files, but the text when I set my UI Language to German always shows in English. On the LoginForm Properties, I have Localizable set to True.

As I want the app to load the screen with the correct language, I placed all my code in the Load Event:

        private void LoginForm_Load(object sender, EventArgs e)
        {
            // Check system language 
            CultureInfo Language = CultureInfo.CurrentUICulture;

            // Check if system language is set to German or English, and display
            // login screen elements as appropriate
            if (Language.Name.ToString() == "Deutsch")
            {
                LoginLabel.Text = Properties.Strings.LoginLabel;
                UserLabel.Text = Properties.Strings.UserLabel;
                PasswordLabel.Text = Properties.Strings.PasswordLabel;
                LoginButton.Text = Properties.Strings.LoginButton;
                ExitButton.Text = Properties.Strings.ExitButton;
            }
        }

I know I'm likely missing something simple, but I can't figure it out. If I need to, I can manually set the Text fields to the German version, but I'd rather have it separated in the .resx files if possible.

Jason Rapp
  • 187
  • 1
  • 10

1 Answers1

0

Changed Language to a string, and removed the if loop, and it's now appearing in German when set that way.

Jason Rapp
  • 187
  • 1
  • 10