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

Localization of SSRS Reports

By , 12 Feb 2009
 
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
Software Developer (Senior)
India India
Member
From Bangalore, India.
My blog: http://smewara.wordpress.com/

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5memberSudhakar Shinde14 Mar '13 - 8:29 
QuestionLocal Time ZonememberMember 171739929 May '11 - 3:55 
AnswerRe: Local Time ZonemvpS Mewara29 May '11 - 6:12 
GeneralMy vote of 5memberMember 776092617 Mar '11 - 4:06 
GeneralRe: My vote of 5mvpSandeep Mewara17 Mar '11 - 9:07 
QuestionSystem cannot find the assembly - can you help?memberMember 776092616 Mar '11 - 17:57 
AnswerRe: System cannot find the assembly - can you help?mvpSandeep Mewara16 Mar '11 - 20:41 
GeneralRe: System cannot find the assembly - can you help?memberMember 776092617 Mar '11 - 4:02 
GeneralRe: System cannot find the assembly - can you help?memberLuis Fernando Forero Guzman15 May '13 - 6:15 
GeneralRe: System cannot find the assembly - can you help?memberMember 776092617 Mar '11 - 5:02 
I finally resolved the issue in the Report Designer.
It turned out that I had 3 releases of Visual Studio installed (8, 9.0 and 10.0).
It turned out I had to place the assembly in the subtree of 9.0 for things to start working.
Strang! I would think that pointing to a file via browsing would be unambiguous but it is not.
 
I just have to find out how to add resources in other languages.
 
Thanks Sandeep for excellent article and for your help.
GeneralRe: System cannot find the assembly - can you help?mvpSandeep Mewara17 Mar '11 - 9:06 
GeneralRe: not working in servermemberKalyancpanda7 Dec '10 - 5:06 
GeneralRe: not working in servermentorSandeep Mewara9 Dec '10 - 5:53 
Generalmy vote 5memberDebajit Bora21 Nov '10 - 4:31 
GeneralMy vote of 5memberthatraja24 Sep '10 - 5:28 
GeneralExcellent ArticlememberMember 253491527 Oct '09 - 2:04 
GeneralHi sandeepmembersarithak5487 Oct '09 - 5:08 
QuestionHow about the report promptmemberfred_0072 Sep '09 - 8:26 
AnswerRe: How about the report promptmemberfred_0072 Sep '09 - 8:58 
QuestionNot able to get text from other languagesmemberAmitChampaneri17 Jul '09 - 3:32 
AnswerRe: Not able to get text from other languagesmemberSandeep Mewara4 Aug '09 - 0:31 
QuestionDoes not work for mememberMember 268234512 Jul '09 - 5:57 
AnswerRe: Does not work for mememberSandeep Mewara13 Jul '09 - 20:13 
GeneralRe: Does not work for mememberMember 268234514 Jul '09 - 7:05 
AnswerRe: Does not work for mememberSandeep Mewara4 Aug '09 - 0:33 
QuestionReportCulture parameter is missing a valuememberscbutler11 May '09 - 4:24 
AnswerRe: ReportCulture parameter is missing a valuememberSandeep Mewara4 May '09 - 20:33 
QuestionPrompts LocalizationmemberMember 391395528 Apr '09 - 1:42 
AnswerRe: Prompts LocalizationmemberSandeep Mewara4 May '09 - 20:28 
QuestionIs it possible to do localization without putting Resoure files into GAC?memberanitatadhani15 Apr '09 - 10:40 
AnswerRe: Is it possible to do localization without putting Resoure files into GAC?memberSandeep Mewara21 Apr '09 - 0:21 
QuestionHow do you add resx file to GAC? [modified]memberjasondwilson7713 Apr '09 - 5:23 
AnswerRe: How do you add resx file to GAC?memberSandeep Mewara21 Apr '09 - 0:20 
GeneralGreat article!memberMichelle Shij3 Apr '09 - 0:39 
AnswerRe: Great article!memberSandeep Mewara6 Apr '09 - 0:43 
GeneralPerfect!!!memberAJenifer16 Mar '09 - 22:02 
AnswerRe: Perfect!!!memberSandeep Mewara6 Apr '09 - 0:43 
Questiongood but need help in seting up the DBmemberKedarvlnt4 Mar '09 - 19:49 
AnswerRe: good but need help in seting up the DBmemberSandeep Mewara4 Mar '09 - 21:09 
GeneralExcellent article!membersankalpv18 Feb '09 - 10:42 
AnswerRe: Excellent article!memberSandeep Mewara22 Feb '09 - 23:10 
GeneralExcellent!memberMember 237722316 Feb '09 - 23:03 
AnswerRe: Excellent!memberSandeep Mewara22 Feb '09 - 23:11 
GeneralSuperb!memberJasonC7213 Feb '09 - 18:41 
AnswerRe: Superb!memberSandeep Mewara15 Feb '09 - 19:10 

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

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