Hello Guys ! In this tutorial I will be showing you how we can add Arabic version to a windows form application in C#. I will be using Windows Form’s built in property called Localisation and Language. So lets get started.

Step 1 : Create a windows forms app with C# project.

Step 2 : Configure your project such as project name and location.

Step 3 : Now that our project is set up, lets design a very basic UI. I have used TableLayoutPanel to align the elements.My version is as shown below :

Step 4 : Now add two items in Combobox collection as below :

Step 5 : Till here we have done nothing special and you will be thinking “Damn ! I know these things man.” So in that case please wait my friend, as the real magic will start.

Every form has two built – in properties called Localisation and Language. I will set these two options here.

Set Localizable to True and for Language property select Arabic.Once you will change the language property you will notice that a new resource file will be generated which you can check at the below location.

Step 6 : Make sure that Arabic resource file is loaded, lets replace the english text with the Arabic translation and make some design adjustments.See below :

Step 7 : Now that we are done with the UI part, lets delve inside some coding part.Add below code in your Form1.cs file.

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            comboBox1.SelectedItem = "English";
        }

        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if(comboBox1.SelectedItem.ToString() == "Arabic")
            {
                Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("ar");
                Controls.Clear();
                InitializeComponent();
            }
            else if(comboBox1.SelectedItem.ToString() == "English")
            {
                Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en");
                Controls.Clear();
                InitializeComponent();
                this.RightToLeft = RightToLeft.No;
            }
                
        }
    }

That’s it ! We are done with this now. To view the result just run the project.For any confusion or clarification kindly comment below.

Happy coding ! 🙂



Leave a Reply

Your email address will not be published. Required fields are marked *