Click here to Skip to main content
6,822,123 members and growing! (18,379 online)
Email Password   helpLost your password?
Database » SQL Reporting Services » General     Intermediate License: The Code Project Open License (CPOL)

Localization of SSRS Reports

By Sandeep Mewara

How to localize the SQL Server Reporting Services Reports
C#, SQL.NET2.0, .NET3.0, .NET3.5SQL2005, Dev, Design
Revision:2 (See All)
Posted:13 Feb 2009
Views:25,315
Bookmarked:37 times
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
30 votes for this article.
Popularity: 6.87 Rating: 4.65 out of 5

1

2
6 votes, 20.0%
3
1 vote, 3.3%
4
23 votes, 76.7%
5
Localized_Report.JPG

Introduction

The article demonstrates the way to localize a SSRS Report.  Although SSRS reports are created in Visual Studio (.NET IDE - BIDS), they can't be localized the same way as the normal VS.NET projects are localized because a resource file can't be added in an SSRS project.  

Localization & Globalization are a normal requirement for any project accessed around the world. Reports being one of the important tools - one needs to support SSRS in multiple languages. This article (and attached demo projects) would help in implementing the same.

Background  

For any product whose customer base is all over the world, one needs to support localization at some stage. Reports, being one major part of any product that helps in analysing the data, too would need localization.  

Initially when I heard of localizing a SSRS report, I was totally unaware of how one can do it! But though Microsoft has not provided a way to add a 'resx' file in order to localize, they have provided a way to use custom assembly and that does the trick!

Using the Code

A custom assembly is made that helps in retrieving the localized value for an asked parameter. Make a class library that has the required 'resx' file and a C# code file to access it based on the culture name passed.

// Method that retrieves the localized value based on the culture name passed
// param1 ("localeSensitiveResource") -> Resource that needs to be localized
// param2 ("cultureInfoName") -> Culture name in which Resource needs to be localized
// returns -> Localized Value
public static string GetString(string localeSensitiveResource, string cultureInfoName)
{
     // Culture formation
     CultureInfo ci = new CultureInfo(cultureInfoName);
     // Value retrieved from the resource file
     return LocalizationStrings.ResourceManager.GetString(localeSensitiveResource, ci);
}

Mark the class as "public static", since it will be accessed from outside and every instance uses the same 'DLL' from the same place.

//Class to retrieve the localized value
public static class LocalizedValue
{    
   public static string GetString
	(string localeSensitiveResource, string cultureInfoName)
   {
        //
   }
}

I have set my sample database tables such that each employee has a locale associated with them. Based on the locale, the report will be localized.

The designed report takes employee's ID as a parameter which internally finds the locale associated and then shows the report data to the user in a localized SSRS report. By default, the sample report would look like:

Non_Localized_Report.JPG

For every caption in the report, one needs to retrieve the localized value for it using a custom assembly made earlier. In order to do it:

Add a reference to the assembly:

Assembly_Reference.JPG

Add VB code to access the class method exposed for localizing:

Code_for_localization.JPG

To localize a caption, right click the textbox and select 'Expression...". Use the custom code to get the localized value for any string. Refer 'resx' file in the library made for parameter name to pass.

=Code.LocalizedValue("REPORTHEADER", Parameters!ReportCulture.Value)

Once the caption(s) are localized using the custom code, the designer would look like:

Designer.JPG

There are few other things that one needs to keep in mind:

  • Sign the assembly with a strong name such that we can keep the resource assembly(s) in the GAC of server.
  • Custom assembly needs to be placed at the following two places:
    • Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies
    • Program Files\Microsoft SQL Server\MSSQL.3\Reporting
  • Place the resource file in report server's GAC

It's done! SSRS Report is now localized.

Points of Interest 

While going through the SSRS localization process, Microsoft article KB920769 helped a lot. (Refer here.)  

History

  • Initial version - 8th Feb, 2009

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Sandeep Mewara


Member
Did my B.Tech from IIT Kharagpur.

Currently, working as a Module Lead at
Proteans Software Solutions Pvt. Ltd., Bangalore.

Proteans is an outsourcing company
focusing on software product development and business
application development on Microsoft Technology Platform.

=====================================================
Occupation: Web Developer
Company: Proteans Software Solutions Pvt. Ltd., Bangalore.
Location: India India

Other popular SQL Reporting Services articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 25 of 30 (Total in Forum: 30) (Refresh)FirstPrevNext
GeneralExcellent Article PinmemberMember 25349153:04 27 Oct '09  
GeneralHi sandeep Pinmembersarithak5486:08 7 Oct '09  
GeneralHow about the report prompt Pinmemberfred_0079:26 2 Sep '09  
GeneralRe: How about the report prompt Pinmemberfred_0079:58 2 Sep '09  
QuestionNot able to get text from other languages PinmemberAmitChampaneri4:32 17 Jul '09  
AnswerRe: Not able to get text from other languages PinmemberSandeep Mewara1:31 4 Aug '09  
QuestionDoes not work for me PinmemberMember 26823456:57 12 Jul '09  
AnswerRe: Does not work for me PinmemberSandeep Mewara21:13 13 Jul '09  
GeneralRe: Does not work for me PinmemberMember 26823458:05 14 Jul '09  
AnswerRe: Does not work for me PinmemberSandeep Mewara1:33 4 Aug '09  
QuestionReportCulture parameter is missing a value Pinmemberscbutler15:24 1 May '09  
AnswerRe: ReportCulture parameter is missing a value PinmemberSandeep Mewara21:33 4 May '09  
QuestionPrompts Localization PinmemberMember 39139552:42 28 Apr '09  
AnswerRe: Prompts Localization PinmemberSandeep Mewara21:28 4 May '09  
GeneralIs it possible to do localization without putting Resoure files into GAC? Pinmemberanitatadhani11:40 15 Apr '09  
AnswerRe: Is it possible to do localization without putting Resoure files into GAC? PinmemberSandeep Mewara1:21 21 Apr '09  
QuestionHow do you add resx file to GAC? [modified] Pinmemberjasondwilson776:23 13 Apr '09  
AnswerRe: How do you add resx file to GAC? PinmemberSandeep Mewara1:20 21 Apr '09  
GeneralGreat article! PinmemberMichelle Shij1:39 3 Apr '09  
AnswerRe: Great article! PinmemberSandeep Mewara1:43 6 Apr '09  
GeneralPerfect!!! PinmemberAJenifer23:02 16 Mar '09  
AnswerRe: Perfect!!! PinmemberSandeep Mewara1:43 6 Apr '09  
Questiongood but need help in seting up the DB PinmemberKedarvlnt20:49 4 Mar '09  
AnswerRe: good but need help in seting up the DB PinmemberSandeep Mewara22:09 4 Mar '09  
GeneralExcellent article! Pinmembersankalpv11:42 18 Feb '09  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads.

PermaLink | Privacy | Terms of Use
Last Updated: 13 Feb 2009
Editor: Deeksha Shenoy
Copyright 2009 by Sandeep Mewara
Everything else Copyright © CodeProject, 1999-2010
Web10 | Advertise on the Code Project