Gridview localization problems

4 posts, 0 answers
  1. Czeshirecat
    Czeshirecat avatar
    66 posts
    Member since:
    Jun 2016

    Posted 15 Jun 2017 Link to this post

    Hi,

    I need to localize the winforms rad grid view control and used the source code displayed on the following page to set up the initial localization

    http://docs.telerik.com/devtools/winforms/gridview/localization/localization

    There's a lot of strings in there and obviously I don't know which functions and parts of the grid trigger many of the strings but from my very brief experience

    1) The "RadGridStringId.NoDataText: return "No data to display";" case statement isn't called.

    2) If I activate the RadGridLocalizationProvider then the search box on the top left of the grid displays "SearchRowTextBoxNullText". If I don't activate the localization provider then the search box displays "Enter text to search".

    3) Looking at the code in the telerik document linked to above there's many strings returned that appear to be variable names rather than string. SearchRowTextBoxNullText is one example, but almost all the case statements beginning with "SearchRow...." appear to be variable names. The same with some of the "ConditionalFormattingPropertyGrid..." case statements.

    I did a dumb copy and conversion to return strings held in my resx files, but felt very uncomfortable about the strings that don't appear to be real english words.

    I can't plug this into production code until Im sure there's no problems and that Im understanding how it works.

    Can you help please.
  2. Hristo
    Admin
    Hristo avatar
    1510 posts

    Posted 15 Jun 2017 Link to this post

    Hello,

    Thank you for writing.

    The NoDataText case statement will be called and executed only when your grid is not populated with data. The result is similar to the one displayed here: http://docs.telerik.com/devtools/winforms/virtualgrid/working-with-data/virtualgrid-populating-with-data.

    Regarding your other two questions, please bear in mind the provided in the documentation article provider is just an example and you should check the returned strings. For example, you can handle only those cases which you need to change: 
    public class MyEnglishRadGridLocalizationProvider : RadGridLocalizationProvider
    {
        public override string GetLocalizedString(string id)
        {
            switch (id)
            {
                case RadGridStringId.NoDataText:
                    return "My No Data Mesage";
                case RadGridStringId.SearchRowTextBoxNullText:
                    return "My Search Row Mesage";
            }
     
            return base.GetLocalizedString(id);
        }
    }

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Czeshirecat
    Czeshirecat avatar
    66 posts
    Member since:
    Jun 2016

    Posted 15 Jun 2017 in reply to Hristo Link to this post

    Hi. Thanks for your answer. It made me investigate further.

    I could see the string "No Data To Display" flash up in english before the grid was filled with data at runtime and the case statement wasn't hit.

    I've just stepped through the code this time. If I don't attach a datasource then "No Data To Display" appears briefly and this time the case statement WAS hit. I have linked a screen shot showing the circled string and the break in the code just before "BLERG BLERG" is hit.

    With reference to the other lines. As an outside dev isn't familiar with every possible permutation and combination of possible strings that might occur when a user plays around with the grid and does something unexpected.

    It would have been better if you'd placed a comment at the side of every non obvious case statement containing the english string that YOU show, rather than just assume we understand what to swap in. for example what does "SearchRowMenuItemChildTemplates" mean? 

    An example of an "obvious" straight swap string being "The composite filter descriptor is not valid."

    I've got a chinese localisation coming up within the next few weeks and the easier these sort of things are to us, the better.
  4. Hristo
    Admin
    Hristo avatar
    1510 posts

    Posted 16 Jun 2017 Link to this post

    Hello,

    Thank you for writing.

    As I said in my previous post the NoDataText case statement will be hit only if the grid has no data. If it is not handled the default message will be displayed.

    As to the other string ids like the SearchRowTextBoxNullText, they will be updated in the documentation article to return the default English message so that confusion can be avoided. Generally, speaking when using the localization provider one needs to handle only those cases which are relevant to their actual scenario and to return a suitable message.

    I hope this helps. Should you have further questions please do not hesitate to write back.

    Regards,
    Hristo
    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top