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

Need help in implementing localization for Telerik Report

2 Answers 120 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tejas
Top achievements
Rank 1
Tejas asked on 20 Apr 2017, 09:40 AM

Hello All,

I am new to Telerik, please excuse me if I'm asking anything obvious.

I am trying to test if localization is working for PDF exported programatically from Telerik Report template created through Visual Studio Report Designer. I set browser's language to Marathi (culture code - mr). Below is my code through which PDF is exported.

public ActionResult DownloadSamplePDFReport ()
{
    Telerik.Reporting.Processing.ReportProcessor reportProcessor =
                    new Telerik.Reporting.Processing.ReportProcessor();
    System.Collections.Hashtable deviceInfo =
        new System.Collections.Hashtable();
    Telerik.Reporting.TypeReportSource typeReportSource =
                 new Telerik.Reporting.TypeReportSource();
    typeReportSource.TypeName = typeof(SampleReport).AssemblyQualifiedName;
    Telerik.Reporting.Processing.RenderingResult result =
        reportProcessor.RenderReport("PDF", typeReportSource, deviceInfo);

    byte[] fileBytes = result.DocumentBytes;
    string fileName = "Output.pdf";

    return File(fileBytes, MediaTypeNames.Application.Octet, fileName);
}

I have created resource file named SampleReport.mr.resx which contains localized strings for Marathi language. Still output PDF contains default strings instead of localized one. Please help me resolved this issue.

Thanks,

Tejas Sutar

2 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 20 Apr 2017, 12:46 PM
Hi Tejas,

For reports created in Visual Studio, you can use standard localization approach with RESX files and a resource manager that gets the culture from the current thread - Localizing Reports.

The current thread's culture must be set before initializing the report in order to get the correct RESX files. In your code snippet this can be done at the beginning of the method.


Let us know if you need further help.

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
Tejas
Top achievements
Rank 1
answered on 20 Apr 2017, 12:51 PM
Thanks Stef..!! I will try & let you know if I get any issue.
Tags
General Discussions
Asked by
Tejas
Top achievements
Rank 1
Answers by
Stef
Telerik team
Tejas
Top achievements
Rank 1
Share this question
or