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

Localization not effect

4 Answers 29 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dario Concilio
Top achievements
Rank 2
Dario Concilio asked on 08 Jul 2016, 09:47 AM

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

4 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 11 Jul 2016, 02:31 PM
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
0
Dario Concilio
Top achievements
Rank 2
answered on 11 Jul 2016, 02:35 PM
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
0
Accepted
Stef
Telerik team
answered on 11 Jul 2016, 03:18 PM
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
0
Dario Concilio
Top achievements
Rank 2
answered on 12 Jul 2016, 06:52 AM

Hi Stef,

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

Thank you.

Tags
General Discussions
Asked by
Dario Concilio
Top achievements
Rank 2
Answers by
Stef
Telerik team
Dario Concilio
Top achievements
Rank 2
Share this question
or