There are already some tutorials that are dedicated to the topic of translations. But I haven’t found one yet that is specifically for reports. That’s why I will take on this task today.
For reports, we currently have the special case that we do not create “empty” objects, but often copy standard reports and customize them for customers. At least this is the case now, maybe this will change in 2021 with the announced report extensions.
Unfortunately, the copied reports are not automatically translated, because you change the IDs – that is, you create a “new” report based on the existing standard report. The translation files of the base application are ID-bound and translate only the standard objects .
In this tutorial we will therefore look at how to create translations for our copied reports using the translation files of the Base App.
How To Translate a Copied Report
- Get Translation Files
- Download Poedit and Load Translation Files Into Memory
Download Poedit. Install and run it. Go to “preferences”. Import translation files in tab “Translation Memory”.
- Install XLIFF Sync
Install XLIFF Sync by Rob van Bekkum.
- Prepare AL Project
Create a new AL Project (AL: Go!). Copy a standard report. Activate feature: TranslationFile in app.json.
- Compile the Project
Compile the project so that a translation file is being generated.
- Create Target Translation File
Use “XLIFF: Create Target Translation File” to create a new translation file.
- Translate Target Translation File in Poedit
Open your Target Translation File in Poedit (Open Externally). Pretranslate the file. Save the file.
- Continue Developing Your Report
Make the changes you need for your report. Use “XLIFF: Synchronize Translation Units” to update target translation files for new captions.
Get Translation Files
To translate our copied reports, you need the translation files of the Base App for our target language. In our example I would like to have the German translations. If you do not know how to get the translation files, you can read about it in this post.
Download Poedit and Load Translation Files Into Memory
Download Poedit. Install it and run it. Go to “File” -> “Preferences”.
Click “Manage” in the tab “Translation Memory”.
Select “Import translation files…”
Select your target translation file, in my case that’s the german translation file.
You should now see the progress and the values for “Stored translations” and “Database size on disk” are increased.
Install XLIFF Sync
Search for the extension XLIFF Sync by Rob van Bekkum and install it.
Alternatively, download it from the Visual Studio Code Marketplace.
Prepare AL Project
I assume that you are able to create an AL project. If not – learn how to get started here. Also you should already have copied a standard report that we can work with. If not, follow the instructions in this tutorial to copy a report.
I created a simple AL Project called TranslateStandardReport and downloaded the symbols. Then i copied the report 1305 “Standard Sales – Order Conf.”.
Next, activate the feature “TranslationFile” in your app.json.
Compile the Project
Compile the project so that a first translation file is generated.
Create Target Translation File
Use the XLIFF Sync function “XLIFF: Create New Target File(s)” to create a new target translation file.
If you receive this error…
…use the function Developer: Reload Window and try again.
Select the default workspace folder.
Next, choose your target language file.
A new translation file will be created for your target language.
Translate File in Poedit
Right Click on your created target translation file and select “Open Externally”. The xliff file should open in Poedit.
If it does not, open your project folder and change the settings of your translation file so that it opens with Poedit.
Use the function Pretranslate in Poedit.
A new dialog opens. Check “Only fill in exact matches” if it is not already checked! If you do not check it, then inaccurate translations may also be filled in.
You will be notified that the operation was succesful.
Save the file in Poedit. The standard translations are now in your translation files.
Continue Developing Your Report
If you continue to change something in your report and there are new captions to be translated, you will need to synchronize your translation units so that your target translation file gets updated.
That’s it. Have fun.