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.
- 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!
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:
|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.|
The subpage can be used to enter translations for any language you wish to support.
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.
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 FilesLink
The Document Creator Translations page includes convenient actions for exporting/importing your report translations to/from XLIFF translation files.
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.
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.
You can use the Copy action to copy translation for selected records.
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.
Adding Translatable Labels to Report ObjectsLink
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.
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
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
|AL: Sample of the trigger code to add for label translation via code|
1 2 3 4 5 6
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
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