Report (RDLC) Localization / Globalization

[VS2010 / ASP.NET Web Forms]

Hi,

In a report (RDLC), I need to provide localization / globalization in two languages ​​(pt-BR and en-US) to the following elements: - Labels / Signatures (fixed text) - Report Viewer user interface (buttons and tooltips for controls such like search, next, previous, etc.). - formation of fields in accordance with the current culture

What is the best way to achieve this?

  • To translate fixed captions / labels, I found some solutions that do the manual translation of an XML RDLC definition using the LabelLocID of a TextBox report as helper. But it seems very ugly and hardworking!

  • To translate the interface, I found solutions that suggested using custom IReportingViewerMessage MSDN . Is there any other solution for this automatically?

  • To format data fields, I can set the attribute of the report language and text field (in RDLC), but I need to set it according to the current culture. How can i do this?

Thanks!

+6
source share
1 answer

I had success with the localization of reports, eating a culture that I would like to display as a report parameter. Here is the basic plan:

  • Set a report parameter that represents the culture code that you want to display. Let me call it pReportCulture. I set a static default value for "en-US"

  • Set the language of your report to parm : Language = Options! pReportCulture.Value. This should set the culture of all text fields, etc. In the report.

  • Be sure to set the date or currency format to the fields that you localize. Use .toString ("c") or other valid formats. If you perform any custom text parsing, you will lose automatic localization from the culture setting.

This should take care of most of the localization mapping.

+9
source

Source: https://habr.com/ru/post/891022/


All Articles