ActiveReports 18 .NET Edition
Report Authors: Designer Components / Design Reports / Design Page/RDLX Reports / Tutorials: Page/RDLX Report Scenarios / Localize RDLX Report Content
In This Topic
    Localize RDLX Report Content
    In This Topic

    This topic describes how to localize a report that targets different languages and cultures. A localized report displays text based on different cultures. 
    Let us use the PatientHealthReport.rdlx report to demonstrate localizing report content in a specific language. 

    Multi-lingual Report

     

    As you may observe, the report is bound to json data sources that contain report data as well as data for localization.

    The report utilizes a report parameter to enable users to choose a language out of English, Japanese, and Chinese. The Lookup function is used to fetch data from other datasets, that contain the localized text for each language. Creating such a report mainly requires report-level settings with smart design and no special features. Consider the following steps for creating such reports:  

    1. We need a DataSet with all the predefined Resource Strings, to contain localized strings for each language according to the report items’ values. For example, in the attached report we have the 'ReportResourceStrings' data source, and 'ReportResourceStringDataSet' dataset with the following fields:
      Resource Strings
      Language1
      Language2
      Language3

      In the report, we are using Culture Code (e.g., "en-US", "ja-JP", and "zh-CN") as column names, so it is much more simplified.
      Label en-US ja-JP zh-CN
      City Hospital City Hospital シティ病院 城市医院
      Patient Name Patient Name 患者名 患者姓名

    2. Setup a report parameter, 'pReportLanguage', to set the report language and culture code. This parameter should prompt the user to select the language.
      Name  pReportLanguage
      Type String
      Available Values Label  Value
      English  en-US
      Japanese  ja-JP
      Chinese  zh-CN

    3. Set the Language property of the report as shown below. This property also sets the Format string of the controls*.

      =Parameters!pReportLanguage.Value
      This should set up the culture of all textboxes etc. in the report.

    4. As we set the column names as culture codes, we will use the parameter to set fields dynamically in the Lookup function.
      Sample expression to display 'Patient ID' label:

      =Lookup("PatientID", Fields!Label.Value, Fields.Item(Parameters!ReportLanguage.Value).Value, "ReportResourceStringsDataSet")
       
    5. One might also like to add conversion values for units used in different cultures like the Resource string dataset. So, for example, for 'en-US', we would like to show temperature unit in °F and for 'ja-JP', we would like to show them in °C. For this, you can add another data set with the following fields:
      • CultureCode
      • ConversionRateToUSD
      • TemperatureUnit

      In our case, 'ReportCultureInfoDataSet' dataset does the conversion. The data is as shown:
      cultureCode conversionRateToUSD  temperatureUnit
      en-US 1 °F
      ja-JP 157.3 °C

      Sample expression to display 'Bill Amount' value:
      =Fields!bill_amount.Value * Lookup(Parameters!pReportLanguage.Value, Fields!cultureCode.Value, Fields!conversionRateToUSD.Value, "ReportCultureInfoDataSet")
       
      Here, 'bill_amount' (default in USD) is converted based on our report language/culture parameter value.

      *You can also select report controls individually and set the Language property so the format changes based on the language parameter. The formatting is applied based on the following priority:      

      1. Control.Language property
      2. Report.Language
      3. Application Environment's Language property
      4. System Language settings.
        Our focus is only scoped to the report-level settings.

    6. Preview the report.
      You will see a prompt to select a language. Select a language and click 'View report'.
    See Also