Different localization for different grids on a form

6 posts, 0 answers
  1. özer
    özer avatar
    22 posts
    Member since:
    Jun 2020

    Posted 23 Jul Link to this post

    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.

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3891 posts

    Posted 23 Jul Link to this post

    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

  3. özer
    özer avatar
    22 posts
    Member since:
    Jun 2020

    Posted 29 Jul in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Hi
    Firstly thank you for the answer.
    In fact, my goal was to show different NoDataText for both grids using two different localization providers.
  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3891 posts

    Posted 29 Jul Link to this post

    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

  5. özer
    özer avatar
    22 posts
    Member since:
    Jun 2020

    Posted 29 Jul in reply to Dess | Tech Support Engineer, Sr. Link to this post

    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.
               

  6. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3891 posts

    Posted 30 Jul Link to this post

    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

Back to Top