Skip to content

Report Translations

Document Creator includes a Report Translations feature which helps to create multilingual reports adding translations as data. The report developer can simply add label placeholders in the report object which automatically populate the Document Creator Translation table. You can configure the settings of the Report Translations feature in the Translations group of the Document Creator Setup page, see Translation Settings.

Benefits:

  • Translations are no longer in code, but have become data
  • Non-existing translation records will automatically be created
  • Translation is no longer restricted to the (AL) extension developer
  • Translations can be created or modified by the end-user as well

Watch the Report Translations (Customize translations yourself) section of our demo video to learn more about the benefits of the Report Translations feature!

Editing Translations

On the Document Creator Translations page you can view, create and edit translations that can be used by reports. By default, the page shows the following columns in the main page:

Column Description
Tag The source text/label placeholder to translate.
Default Translation / Unspecified Language Translation The translation for language code ''.
To-do Specifies whether the Tag still needs a Default Translation.
To-do exists Specifies whether there is a translation record with a To-do for any language for the Tag. The translations of the Tag can be found in the Document Creator Translations subpage.
Report ID If empty, the translations will be used by all reports. If not empty, the translations will be used as report-specific translations for the report object with the specified ID.
Report Caption The report caption of the report to which the translations apply.
Last Used Specifies when the translation was last used. Whether or not this field is updated depends on the Update Usage setting.
Last Used by Report ID Specifies the ID of the report that last used the translation. Whether or not this field is updated depends on the Update Usage setting.

document-creator-translations

The subpage can be used to enter translations for any language you wish to support.

Info

The Document Creator Translations page also features a Copy... action that can be used to copy translations as report-specific translations or copy translations for one language code to translations for another language code. See Copying Translations.

Important

Document Creator ships with a Translations package that already provides you with a set of translations for multiple languages. See Import Translations Template.

Export to / Import from XLIFF Translation Files

The Document Creator Translations page includes convenient actions for exporting/importing your report translations to/from XLIFF translation files.

xliff-export-import

With the Export Translations... action, it is possible to export all translations for one language to an .xlf file, or for multiple languages to a .zip containing multiple .xlf files for each language code. It is also possible to export the report-specific translations by specifying the report to export the specific translations for.

xliff-export-page

With the Import Translations... action, you can select an .xlf file to import the translations for one language, or select a .zip file containing multiple .xlf files to import the translations for multiple languages at once.

Copying Translations

You can use the Copy action to copy translation for selected records.

Copy Translations Action

This action opens the Copy Translations report which allows you to copy translations in the following ways:

  • Report Specific Translations: Copy the translations of the selected record(s) as report-specific translations by specifying the Target Report ID.
  • Copy Language Translations: Copy the translations of the selected record(s) from one specific language to another specific language. Note that the blank language code concerns the Default Translation/Unspecified Language Translation.
  • Copy Translations to Tag: Copy the translations of one specific tag to another specific tag.

It is also possible to combine these options.

There is also an Overwrite option which let's you specify if you would like existing translations to be overwritten.

Copy Translations Report

Adding Translatable Labels to Report Objects

Warning

The following section provides details on how an (AL) extension could utilize the Report Translations feature in the report object definition. Some prior knowledge on extension development is expected.

Tip

It is also possible to add translatable labels more conveniently with the Dataset Extensions feature!

Many document types in Dynamics 365 Business Central have a "Language Code" in the document header. To translate report labels to the document language and automatically retrieve the translations and/or populate the Document Creator Translation table with To-do's you can use the wDCR_TranslationMgt codeunit in your report object.

For an example, please see the 'Document Creator" report objects. The AL source code of these report objects is available on the Downloads drive.

First add the following needed global variables:

AL: Sample of the global variables to add for label translation via code
1
2
3
4
var
    Language: Codeunit Language;
    wDCR_TranslationMgt: Codeunit wDCR_TranslationMgt;
    ReportId: Integer;

Add the following code in the OnAfterGetRecord trigger of the document header dataitem, which updates the current report language and passes the "Language Code" of the document to the wDCR_TranslationMgt codeunit:

AL: Sample of the trigger code to add for label translation via code
1
2
3
4
5
6
trigger OnAfterGetRecord()
begin
    CurrReport.Language := Language.GetLanguageIdOrDefault("Language Code");
    wDCR_TranslationMgt.wgFncSetLanguageCode("Language Code");
    // ...
end;

Add the following local procedure that can be used to retrieve translations for the report:

AL: Sample of procedure to quickly retrieve label translations for report columns
1
2
3
4
5
6
7
8
local procedure Trl(pLblName: Text[50]): Text
begin
    if ReportId = 0 then begin
        Evaluate(ReportId, DelChr(CurrReport.ObjectId(false), '=', DelChr(CurrReport.ObjectId(false), '=', '1234567890')));
        wDCR_TranslationMgt.wgFncSetReportId(ReportId);
    end;
    exit(wDCR_TranslationMgt.wgFncTranslate(pLblName));
end;

You can then use the Trl local procedure in the expression of a report column to add a translatable label to the dataset, e.g.:

AL: Sample of how to add label translations as report columns
1
2
3
4
5
column(lblAllowInvDisc; Trl('AllowInvDisc')) { }
column(lblAmount; Trl('Amount')) { }
column(lblBankAccNo; Trl('BankAccNo')) { }
column(lblBankName; Trl('BankName')) { }
// ...

Last update: June 9, 2023