This is a migrated thread and some comments may be shown as answers.
Different localization for different grids on a form
5 Answers 1 View
This is a migrated thread and some comments may be shown as answers.
özer
Top achievements
Rank 1
özer asked on 24 Jul 2020, 01:11 AM

Hi.

Can different localizations be applied for different grids on a form? For example, one is English, one is German, the other is Spanish, etc.

5 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 24 Jul 2020, 04:31 AM
Hello, özer, 

The localization provider is static and it is shared by all RadGridView instances inside the application. Usually, it is expected to use one common language for the application at a time according to the end-user that is currently running the project. That is why you can't have multiple grids on the form translated in different languages. 

If you are not providing full translation to the grid, it would be greatly appreciated if you specify which text exactly you want to translate. Thus, we would be able to think about a suitable solution and provide further assistance. Thank you in advance.

I hope this information helps. If you need any further assistance please don't hesitate to contact me. 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

0
özer
Top achievements
Rank 1
answered on 29 Jul 2020, 01:00 PM
Hi
Firstly thank you for the answer.
In fact, my goal was to show different NoDataText for both grids using two different localization providers.
0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 29 Jul 2020, 01:24 PM

Hello, özer,

This can be easily achieved via the TableElement.Text property: 

            this.radGridView1.TableElement.Text = "Sample text";
            this.radGridView2.TableElement.Text = "Sample text 2";

I believe that it would cover your scenario.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

0
özer
Top achievements
Rank 1
answered on 29 Jul 2020, 03:47 PM

Hello again Dess.

RadGridLocalizationProvider.CurrentProvider = new Localization();
rgvReportList.TableElement.Text = "sample text";
rgvLog.TableElement.Text = "sample text2";

Typing your snippet after the localization code did not work. But it worked when I ran the localization code on a condition.

if (rgvReportList.RowCount > 0)
{
   RadGridLocalizationProvider.CurrentProvider = new Localization();
}
rgvReportList.TableElement.Text = "sample text";
rgvLog.TableElement.Text = "sample text2";

Thanks again.
           

0
Dess | Tech Support Engineer, Sr.
Telerik team
answered on 30 Jul 2020, 12:33 PM

Hello, özer,

I am glad that you have found a suitable solution for your scenario.

Indeed, the suggested code doesn't take effect if you change the localization provider after calling the InitializeComponent method: 

        public RadForm1()
        {
            InitializeComponent();
            RadGridLocalizationProvider.CurrentProvider = new MyEnglishRadGridLocalizationProvider();
            this.radGridView1.TableElement.Text = "Sample text";
            this.radGridView2.TableElement.Text = "Sample text 2";
        }

It is necessary to specify the CurrentProvider property before initializing the components.

This is how it should be applied:

        public RadForm1()
        {
            RadGridLocalizationProvider.CurrentProvider = new MyEnglishRadGridLocalizationProvider();
            InitializeComponent();

            this.radGridView1.TableElement.Text = "Sample text";
            this.radGridView2.TableElement.Text = "Sample text 2";
        }

Feel free to use this approach which suits your requirements best.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Asked by
özer
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Sr.
Telerik team
özer
Top achievements
Rank 1
Share this question
or