Localization not effect

5 posts, 1 answers
  1. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 08 Jul Link to this post

    Hi I'm trying to keep Localizable property, I create a report (in default Language), after I setup Language = English (en) and translate static object.

    I'm using this code to show report preview, but when LinguaParameter contains "en" Language, it has no effect. Why?

    I've attach design of report.

    01.Private Sub ReportForm_Load(sender As Object, e As EventArgs) Handles Me.Load
    02. 
    03.    'Cerco il parametro lingua
    04.    Dim _CultureInfo As System.Globalization.CultureInfo = Nothing
    05.    Dim _LinguaParameter = m_Parameters.SingleOrDefault(Function(rec) rec.Name.StartsWith("Lingua"))
    06. 
    07.    If _LinguaParameter IsNot Nothing Then
    08. 
    09.        If CStr(_LinguaParameter.Value) <> Lingua.LinguaItaliana Then
    10. 
    11.            _CultureInfo = New System.Globalization.CultureInfo(Lingua.Items.Single(Function(rec) rec.Descrizione = CStr(_LinguaParameter.Value)).Codice)
    12.            System.Threading.Thread.CurrentThread.CurrentUICulture = _CultureInfo
    13. 
    14.        End If
    15. 
    16.    End If
    17. 
    18.    MainReportViewer.ViewMode = Telerik.ReportViewer.WinForms.ViewMode.PrintPreview
    19. 
    20.    Dim _Instance As New InstanceReportSource
    21.    _Instance.ReportDocument = m_ReportToShow
    22. 
    23.    If m_Parameters IsNot Nothing Then
    24.        _Instance.Parameters.AddRange(m_Parameters)
    25.    End If
    26. 
    27.    MainReportViewer.ReportSource = _Instance
    28. 
    29.    MainReportViewer.RefreshReport()
    30. 
    31.End Sub

  2. Stef
    Admin
    Stef avatar
    3047 posts

    Posted 11 Jul Link to this post

    Hello Potito,

    The report instance must be created after changing the current thread's culture settings.

    In general, in the report's InitializeComponent method is created a resource manager which uses the current thread's culture. Thus the culture settings must be changed before that moment.
    For more details, please check Localizing Reports.

    Regards,
    Stef
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. DevCraft banner
  4. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 11 Jul in reply to Stef Link to this post

    In fact it is not very clear, the code shown does not mention the onload event and enter the code portion before dell'InitialComponent.

    Thank you for the clarification
  5. Answer
    Stef
    Admin
    Stef avatar
    3047 posts

    Posted 11 Jul Link to this post

    Hi Potito,

    Thank you for this feedback.
    We will update the online documentation to include the mentioned details.

    Regards,
    Stef
    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Dario Concilio
    Dario Concilio avatar
    129 posts
    Member since:
    Apr 2016

    Posted 12 Jul in reply to Stef Link to this post

    Hi Stef,

    I changed my code, it's all ok now.

    Thank you.

Back to Top
DevCraft banner