You can localize your reports to display in the language of a specific culture. For example, your report may display in both
English and Spanish (see figure below).
The standalone Report Designer serializes the report definitions in XML but currently no pattern is available for localizing XML documents.
Our suggestion is to create a User Functions that will accept resource key and optionally language parameter and based on those parameters
to resolve the appropriate resource.
Telerik Reporting uses a similar methodology for localization as Visual Studio uses for Windows Forms.
The designer lets you define static text for the report (e.g. column headings, titles) in each language that you specify.
A resource file (resx) is automatically created for each language to store translated text. For more background information on
localizing applications see the MSDN article
Globalizing and Localizing Applications.
To localize a report:
- In the designer set the Report Localizable property to true.
- Select a Language property value from the drop down list in the properties window.
- Translate the static text into the desired language indicated by the Language property.
To run a localized report:
- Add Threading and Globalization namespaces to your application.
- Set the current thread CurrentUICulture to a new instance of CultureInfo. The CultureInfo constructor takes the culture code of the language you want to display. For example "en-US" for United States English or "es-MX" for Mexican Spanish.
- Optionally you can set the CurrentCulture for the current thread to the culture code of the language you wish to display. CurrentCulture affects dynamic data such as date, time and money formats. The "Birth Date" column date format in the figure above shows Month/Day/Year in English, but in Day/Month/Year format in the Spanish example.
Create an instance of the report and assign it to the ReportViewerReportSource property. If you are using a ReportViewer in a Windows application,
call the ReportViewer.RefreshReport() method.
[C#] Setting the language at runtime
var cultureInfo = new System.Globalization.CultureInfo("es-MX");
System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo;
System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo;
reportViewer1.ReportSource = new Telerik.Reporting.InstanceReportSource
ReportDocument = new Report1()