This is a migrated thread and some comments may be shown as answers.

Right-to-Left Language Translation

7 Answers 67 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 09 Nov 2014, 03:17 PM
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

7 Answers, 1 is accepted

Sort by
0
Galin
Telerik team
answered on 12 Nov 2014, 05:19 PM
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.

 
0
Daniel
Top achievements
Rank 1
answered on 13 Nov 2014, 02:03 PM
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.
0
Galin
Telerik team
answered on 17 Nov 2014, 04:15 PM
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.

 
0
Daniel
Top achievements
Rank 1
answered on 18 Nov 2014, 08:47 AM
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.
0
Accepted
Galin
Telerik team
answered on 19 Nov 2014, 12:56 PM
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.

 
0
Daniel
Top achievements
Rank 1
answered on 23 Nov 2014, 10:28 AM
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.
0
Daniel
Top achievements
Rank 1
answered on 23 Nov 2014, 12:38 PM
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.


Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Galin
Telerik team
Daniel
Top achievements
Rank 1
Share this question
or