Good day
How to create a multilingual windows form that can change the display language of open dialog box?I have a form application and would like the user to change the language of display. Here is my code, so far I can change the form controls including the menu item, I couldn't change the show dialog boxes button texts (ok, cancel, abort...) so I decide to create my own normal window form to act as a dialog box, and it's working fine.
I selected the Localizable property of the form to True and created a language resource file (resx) for each language. It working fine even if I have to restart the application for the language to take effect, I don't have a problem with that though.
The problem is how to change the open dialog box, because I couldn't create a custom one. Let say I want an open dialog box where a user can browse and open an image, it still display in English (File name, Open and Cancel Button...)
Here is my code:
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;
using System.Resources;
using System.Net.NetworkInformation;
namespace Language
{
public partial class Form1 : Form
{
public string language = Properties.Settings.Default.Langue;
public Form1()
{
Thread.CurrentThread.CurrentUICulture = new CultureInfo(language);
InitializeComponent();
}
private void englishMenuItem_Click(object sender, EventArgs e)
{
language = "en";
englishMenuItem.Checked = true;
germanMenuItem.Checked = false;
frenchMenuItem.Checked = false;
// Save user choice in settings
Properties.Settings.Default.Langue = "en";
Properties.Settings.Default.Save();
}
private void frenchMenuItem_Click(object sender, EventArgs e)
{
// ChangeLanguage("fr-FR");
language = "fr-FR";
frenchMenuItem.Checked = true;
germanMenuItem.Checked = false;
englishMenuItem.Checked = false;
// Save user choice in settings
Properties.Settings.Default.Langue = "fr-FR";
Properties.Settings.Default.Save();
}
Thank you very much