Click here to Skip to main content
Click here to Skip to main content

Localization of SSRS Reports

, 13 Feb 2009 CPOL
Rate this:
Please Sign up or sign in to vote.
How to localize the SQL Server Reporting Services Reports
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)

Share

About the Author

Sandeep Mewara
Software Developer (Senior)
India India
Current location: Bangalore, India.
Follow on   Twitter

Comments and Discussions

 
QuestionResource file is not switching with the given parameter. PinmemberAniletB31-May-14 9:12 
AnswerRe: Resource file is not switching with the given parameter. Pinmemberfecaloid monster11-Aug-14 6:39 
QuestionProblem with SSRS Authentica​tion - don't want to use Custom Authentica​tion - Please guide PinmemberMember 1069685125-Mar-14 5:22 
QuestionReport paremeters localization PinmemberVoland0317-Jun-13 13:23 
AnswerRe: Report paremeters localization PinmvpSandeep Mewara17-Jun-13 20:30 
GeneralMy vote of 5 PinmemberSudhakar Shinde14-Mar-13 9:29 
QuestionLocal Time Zone PinmemberMember 171739929-May-11 4:55 
AnswerRe: Local Time Zone PinmvpS Mewara29-May-11 7:12 
GeneralMy vote of 5 PinmemberMember 776092617-Mar-11 5:06 
GeneralRe: My vote of 5 PinmvpSandeep Mewara17-Mar-11 10:07 
QuestionSystem cannot find the assembly - can you help? PinmemberMember 776092616-Mar-11 18:57 
AnswerRe: System cannot find the assembly - can you help? PinmvpSandeep Mewara16-Mar-11 21:41 
GeneralRe: System cannot find the assembly - can you help? PinmemberMember 776092617-Mar-11 5:02 
GeneralRe: System cannot find the assembly - can you help? PinmemberLuis Fernando Forero Guzman15-May-13 7:15 
GeneralRe: System cannot find the assembly - can you help? PinmemberMember 776092617-Mar-11 6:02 
GeneralRe: System cannot find the assembly - can you help? PinmvpSandeep Mewara17-Mar-11 10:06 
GeneralRe: not working in server PinmemberKalyancpanda7-Dec-10 6:06 
Hi Sandeep ,
That's a great article which helped me a lot. But I still have some problems with it.
It is working fine on my computer ( local system) but when I deploy it to the server I get #error on the column. I moved the files to all the places you have told me and also to the report server and report manger bin folder and GAC. But I still get this error. I really can't understand what else can I do? Please help me here as it is very important for us to get this done.
In my local system I have my reporting services folder in MSSQL3 folder but in the server it is in MSSQL2 folder. Will this be any issue?
GeneralRe: not working in server PinmentorSandeep Mewara9-Dec-10 6:53 
Generalmy vote 5 PinmemberDebajit Bora21-Nov-10 5:31 
GeneralMy vote of 5 Pinmemberthatraja24-Sep-10 6:28 
GeneralExcellent Article PinmemberMember 253491527-Oct-09 3:04 
GeneralHi sandeep Pinmembersarithak5487-Oct-09 6:08 
QuestionHow about the report prompt Pinmemberfred_0072-Sep-09 9:26 
AnswerRe: How about the report prompt Pinmemberfred_0072-Sep-09 9:58 
QuestionNot able to get text from other languages PinmemberAmitChampaneri17-Jul-09 4:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

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

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141216.1 | Last Updated 13 Feb 2009
Article Copyright 2009 by Sandeep Mewara
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid