Question

We have a huge number of Page Reports created using ActiveReport (*.rdlx files) We use them from our ASP.NET MVC web appolication.

All captions and other stuff were initially created on English

Now we need to add a multilanguage support there so, somehow we need all existing texts be inserted in resource file and so we can then add translations

Is there a way to achive this task quickly, without going to each report field and manually extracting it into resource file? Documentation says that once you change Language property, resource files will be created, but seems it is not working for XML reports, or there shouldbe a trick

For the reports designed with Code-behind, resource files are created pretty much the same as if you will create a Windows form... but I fail to find out how to do this for XML reports.

Was it helpful?

Solution

Page Reports support a localization; however it doesn't do so with a resource file.

This is mentioned off-hand in a single sentence on the page about Localization with ActiveReports 7.

Setting up a localized value in a Page Report is done the same was as you do in a Section Report. Simply change the report's Language property and then set new textbox values. At report runtime the appropriate value for the textbox will get used.

As I mentioned above, this doesn't generate a separate .resx file; instead if you inspect the resulting .rdlx you'll find a custom dd:LocalizationResources element is created that specifies the language setting and the new values for report elements.

OTHER TIPS

The Localize property you are referring to in the documentation and in the code-behind reports are for the code-based "Section Layout" Reports but won't work for XML-based "Page Layout" reports (if you look at the generated code for the report, you'll see that the designer is just generating a bunch of code to localize the report).

Since code-behind reports support custom code or you can add references to another DLL you can write a simple function to localize captions. There is a good example of localizing this for .rdl reports here, you can use exactly the same approach with the ActiveReports' .rdlx files.

During that initial configuration of the report to be localizable you'll either have to manually change each static string to a Code.LocalizedValue call or maybe you could write a simple script to find each //Textbox/Value elements and replace it with a similar call. A simple script with a combination of xpath and regex could do help you automate the initial configuration of the report. To localize something other than a Textbox Value in the report (e.g. report parameter, labels/bookmarks), you'll need to replace the text of a different element than the Textbox Value but the concept is the same.

Of course, I am assuming you are localizing the static strings in your report. If you want to localize the values from the database then you'll have to do that differently (comment if you need help and I'll explain).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top