Right-to-Left Language Translation

8 posts, 1 answers
  1. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 09 Nov 2014 Link to this post

    Hello,

    I am working on a project with RadGrid.

    My site is multilingual and therefore I use RadGrid.Main.resx.
    There is a problem / bug in RTL languages.
    If I use DateRange filter and I use Hebrew as my language:
    A. The fields “From” and “To” are not translated into Hebrew.
    B. The filter is not up to par with RTL, but remained in LTR / or it aligns wrong is not exactly clear. See attached picture

     I will be happy to receive a solution.

    Thanks,
    Daniel
  2. Galin
    Admin
    Galin avatar
    526 posts

    Posted 12 Nov 2014 Link to this post

    Hello Daniel,

    In order to achieve this you should wrap the text in a label or other HTML element and use the following CSS rule

    .rgFilterRow > td > * {
        float: right;
    }

    You can find a sample page in the attached archive. I hope this helps.

    Regards,
    Galin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  3. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 13 Nov 2014 in reply to Galin Link to this post

    Hello Galin,

    Thank you for your reply!

    In my project there is dynamic data - I do not know which kind of data will be in a column – every time it changes,

    I use these settings (in VB.NET):
    Private Sub RadGrid1_ColumnCreated(sender As Object, e As Telerik.Web.UI.GridColumnCreatedEventArgs) Handles RadGrid1.ColumnCreated
            If e.Column.ColumnType = "GridDateTimeColumn" Then
                'CType(e.Column, GridDateTimeColumn).EnableTimeIndependentFiltering = True
                CType(e.Column, GridDateTimeColumn).FilterDateFormat = "dd/MM/yyyy HH:mm:ss"
                CType(e.Column, GridDateTimeColumn).DataFormatString = "{0:dd/MM/yyyy HH:mm:ss}"
                CType(e.Column, GridDateTimeColumn).PickerType = GridDateTimeColumnPickerType.DateTimePicker
                'CType(e.Column, GridDateTimeColumn).FilterTemplate.InstantiateIn(New RadDateTimePicker With {.ID = "RadDateTimePickerFrom"})
                'If e.Column.UniqueName = "Date" Then
                CType(e.Column, GridDateTimeColumn).EnableRangeFiltering = True
                'End If
            End If
        End Sub

    I did some tests and it seems that when you translate the word “From” into Hebrew, the filter aligns as it should be [see video]

    Would love to have a solution that fits my project requirements.

    Thanks,
    Daniel.
  4. Galin
    Admin
    Galin avatar
    526 posts

    Posted 17 Nov 2014 Link to this post

    Hello Daniel,

    In this case I suggest you to target only the RadGrid which is in RTL mode as in the modified CSS rules

    .RadGridRTL .rgFilterRow > td > * {
        float: right;
    }
     
    .RadGridRTL .rgFilterRow > td > label  {
        padding: 0 10px;
    }

    Please check it out and let me know how it goes.

    Regards,
    Galin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  5. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 18 Nov 2014 in reply to Galin Link to this post

    Hi Galin,

    Thank you very much for your reply.

    Unfortunately, I didn’t explain myself properly.

    I do not want and cannot use the FilterTemplate in the design (ASPX), because my data is dynamic and changing. Therefore, setting the DateRange Filter can only be done in the code itself.

    My current code:

    ASPX:
    <telerik:RadGrid ID="RadGrid1" runat="server" GroupPanelPosition="Top" >  </telerik:RadGrid>

    VB.NET:
    Private Sub RadGrid1_ColumnCreated(sender As Object, e As Telerik.Web.UI.GridColumnCreatedEventArgs) Handles RadGrid1.ColumnCreated
          If e.Column.ColumnType = "GridDateTimeColumn" Then
              CType(e.Column, GridDateTimeColumn).FilterDateFormat = "dd/MM/yyyy HH:mm:ss"
              CType(e.Column, GridDateTimeColumn).DataFormatString = "{0:dd/MM/yyyy HH:mm:ss}"
              CType(e.Column, GridDateTimeColumn).PickerType = GridDateTimeColumnPickerType.DateTimePicker
              CType(e.Column, GridDateTimeColumn).EnableRangeFiltering = True
          End If
      End Sub

    It seems that the problem is that the words "From" and "To" is not translated into Hebrew.
    Is there a way to translate them, WITHOUT using FilterTemplate?

    Thanks,
    Daniel.
  6. Answer
    Galin
    Admin
    Galin avatar
    526 posts

    Posted 19 Nov 2014 Link to this post

    Hello Daniel,

    It seems you want to localize the filtering. This however is already logged in our Public Feedback Portal. Please vote for the item. Also I rise its priority and our developers will add this feature as soon as possible.

    In the meantime please use the following workaround:
    Protected Sub RadGrid1_ItemCreated(sender As Object, e As GridItemEventArgs)
        Dim filterItem As GridFilteringItem = TryCast(e.Item, GridFilteringItem)
        If filterItem IsNot Nothing Then
            TryCast(filterItem("DateTimeColumnUniqueName").Controls(0), LiteralControl).Text = "TextFrom"
            TryCast(filterItem("DateTimeColumnUniqueName").Controls(3), LiteralControl).Text = "TextTo"
        End If
    End Sub

    I hope this helps.

    Regards,
    Galin
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  7. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 23 Nov 2014 in reply to Galin Link to this post

    Hi Galin,

    Thank you for your reply,

    Unfortunately, my project has dynamic data, so I cannot know in advance the type or name of each column.
    I want to apply the code you have provided only on columns whose items are of a DateTime type. I would glad to have such a solution that fits my project requirements.

     Thank you,
    Daniel.
  8. Daniel
    Daniel avatar
    159 posts
    Member since:
    Feb 2014

    Posted 23 Nov 2014 in reply to Daniel Link to this post

    Hi Galin,

    I just found the solution:

    Private Sub RadGrid1_ItemCreated(sender As Object, e As GridItemEventArgs) Handles RadGrid1.ItemCreated
           Dim filterItem As GridFilteringItem = TryCast(e.Item, GridFilteringItem)
           If filterItem IsNot Nothing Then
               For Each filter As Telerik.Web.UI.GridTableCell In filterItem.Cells
                   If filter.Column.DataType() Is GetType(System.DateTime) Then
                       TryCast(filterItem(filter.Column.UniqueName).Controls(0), LiteralControl).Text = "מתאריך"
                       TryCast(filterItem(filter.Column.UniqueName).Controls(3), LiteralControl).Text = "לתאריך"
                   End If
               Next
           End If
    End Sub


    Thanks,
    Daniel.


Back to Top