我正在嘗試設置一個 Windows 窗體登錄屏幕,該屏幕使用用戶的語言來設置課程的德語或英語。我已在項目的屬性中設置了.resx文件,但我無法弄清楚為什么表單始終以英文顯示。我回顧了如何在 C# 中使用本地化和如何在 winforms 中制作多語言應用程序,這是我找到有關設置Strings.resx和Strings.de.resx文件的信息的地方,但是當我將 UI 語言設置為德語時,文本始終顯示為英語。在 LoginForm 屬性上,我已Localizable設置為True。由于我希望應用程序使用正確的語言加載屏幕,因此我將所有代碼放置在加載事件中: 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; } }我知道我可能錯過了一些簡單的東西,但我無法弄清楚。如果需要,我可以手動將文本字段設置為德語版本,但.resx如果可能的話,我寧愿將其在文件中分開。
添加回答
舉報
0/150
提交
取消