Report options in several languages

For each report in your 1C:Enterprise application, a user having appropriate rights can create a number of report options. Each report option is a modification of the base report that has its specific settings on what input data the report should be generated for and how the report should look like (included fields, sorting orders, groupings, conditional formatting).

A report option has a name. When the user clicks the Report variants button on a report's page, the system displays the list of report options that are available for the given report and the user can choose which of them to open. In the Infobase, these names and other settings of the report options are stored in the "ReportsVariants" catalog.

If your 1C:Enterprise application supports several languages, you may need to ensure that for the user who opens the list of report options for a report, the system only displays their names in the language specified for the user in the application. From the technical point of view, to support this, the system is to store the names of each report option in all the languages your application configuration supports and select the appropriate names for displaying depending on the user's language.

To solve this task, you can use the following approach:

  1. Add the "MultilingualValuesReports" tabular section to the "ReportsVariants" catalog.
  2. Specify the "LanguageKey", "Description", and "Definition" attributes in the tabular section.

    These attributes are to store the language code, name, and description of a report option respectively.

  3. Add a table to the form used for saving items of the "ReportsVariants" catalog.
  4. Bind the "LanguageKey", "Description", and "Definition" attributes to the corresponding columns of the table.

  5. In the "ReportsPanel" common form's module, define a procedure that fills the Reports panel, and in the procedure, filter the list of report options to display by using code like this:
      UserLanguage = InfoBaseUsers.CurrentUser().Language;
      If NOT UserLanguage = Undefined Then
        LangKey = InfoBaseUsers.CurrentUser().Language.LanguageCode;
        If Not LangKey = "en" Then
          For Each RepVar In ResultTable Do
            If RepVar.Ref.MultilingualValuesReports.Count() > 0 Then
              FindLoc = RepVar.Ref.MultilingualValuesReports.Find(LangKey,"LanguageKey");
              RepVar.Description = FindLoc.Description;
              RepVar.Definition = FindLoc.Definition;

Finally, for each report option, the user populates the table of localized report option names.

For instance, if your application supports two languages (English and German), the user should open a report option and then add two rows to the table:

  • "en", report option's name in English, report option's description in English
  • "de", report option's name in German, report option's description in German

As a result, when the user whose language in your application is English opens a report having options and clicks the Report variants button, the system displays the report option names in English only. Likewise, the user whose language is German can see the report option names in German only.

You can use a similar approach to implement a multilanguage items catalog.

Next page: Modifying 1Ci supported configurations

Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.