While playing around with the report viewer controls and localization, I bumped into a few things I think are worth passing along.
In the “I should have known this in the first place” department, you must take steps to make sure the report viewer runs with the right culture settings in a web application.
While Report Manager automatically picks up the regional settings from the headers sent by your client (IE) and responds accordingly, ASP.NET does not.
So, you have to add a bit of code to make sure the web application changes culture based on information sent along by the browser. The following snippet in OnLoad() will work nicely:
Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages);
Thread.CurrentThread.CurrentUICulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages);
If you forget to do this (like I did) the report and viewer will never get localized, regardless of the regional settings on the client.
After that, you’ll get some of the report viewer localization functionality working. By that I mean you’ll see that the list of export formats is localized, etc. However, the labels on the report viewer toolbar (like “Export”, “Find | Next”, and “1 of X”) are not localized. To get THESE localized as well, you’ll need to install a language pack for the locale you’re interested in – ReportViewerLP.exe does this for you. I’m not clear where in Visual Studio 2005 and/or the Framework 2.0 SDK you’ll find these redists yet, but will post once I do.
After installing ReportViewerLP.exe for the specific locales you’re targeting, your report viewer controls will be happy and fully localized.
Oh, another question I’ve seen is “how do I install the report viewer controls to begin with?”. You’ll need to find and run the ReportViewer.exe redist, which is located in C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\v2.0\Bootstrapper\Packages\ReportViewer