How To Translate Copied Reports
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.
6 thoughts on “How To Translate Copied Reports”
thank you, it was PRETTY useful
Damn it. I gave everything to write 10 tips together, but in the end there were only 9. Reports can drive you to despair in AL. While extensions have been available for tables and pages for a long time, we have to be patient with reports until the following screenshot of a report extension becomes reality.
To make your life as easy as possible until then, I’d like to share a few tips for developing reports in AL. For some of you there might be nothing new, but some of you might take something with you.
All right. Let’s go.
#1 Navigate Through Your Symbols with Ctrl + Shift + O
Reports can have a high complexity. The standard “Sales – Order Conf.” (Report 1305) in Business Central has 5 DataItems. This makes it difficult to navigate through the different DataItems, triggers and other code locations.
Therefore, it is advisable to use the command “Go to Symbol in Editor…”. (Ctrl + Shift + O). The command shows you a list of your symbols and allows you to search the symbols.
For example, you can search for “@onafter” and quickly jump to your OnAfterGetRecord triggers.
You can quickly jump to your request page with the search term “@req”.
…or even search for the individual fields in your request page.
#2 Jump To The Start/End Of Your DataItem With Ctrl + Shift + ^
This one will be new for some people. With the command “Go to Bracket” (Ctrl + Shift + ^) you can comfortably jump either to the end or start of an indentation or bracket.
For example, if you stand in the beginning bracket of your DataItem (line 13) and execute the command, your cursor will be moved to the end of the DataItem – where the triggers are located. Cool shit, right?
#3 Jump To The Start Of Your Global Variables With Ctrl + G
If you have a report with more than 1000 lines, you may not always want to scroll to your global variables. Use Rasmus Aaen’s Variable Helper to jump to the beginning of your global variables.
The command “AL-Var: Global Variables” (Ctrl + G) is a real time saver…
…and gets you over here real quick:
#4 Jump To The End Of Your Global Variables With Ctrl + Alt+ G
If you have many variables in your report, it might not be enough to jump to the beginning of these variables. Use my extension AL Navigator to jump to the end of your variables.
The extension provides a command “AL: Navigator: Last global var line” (Ctrl + Alt + G).
#5 Jump Through Your DataItems With Ctrl + Alt + D Or Shift + Alt + D
My extension AL Navigator offers other functionalities. Use the commands “AL Navigator: Next DataItem (starting from bottom)” (Shift + Alt + D) or “AL Navigator: Next DataItem (starting from top)” (Ctrl + Alt + D) to “jump” through your DataItems.
With each call of the command the cursor jumps to the next DataItem:
#6 Add New Variables With The Quick Fix Lamp (Ctrl + .)
Sometimes you just want to pass a new variable as column in the dataset. You can use the CodeAction “Add global Variable” of the AL Navigator to create the new variable from the column. Pretty comfortable, isn’t it? 😉
Of course this CodeAction also works in functions and triggers, as you can see below. In the following gif I am standing in the OnInitReport-Trigger and create a global record “Company Information” from there.
#7 Translate Your Copied Standard Report With Poedit
As long as we don’t have report extensions, we have to copy standard reports to customize them. Unfortunately the copied reports are not automatically translated. Use Poedit to automatically add the translations for the copied standard reports. In this tutorial I explained how this works.
#8 Export Your Dataset By Using The Mini Report Inspector
In the Windows client we were able to view the dataset of a report. In the Web Client this is no longer possible in the standard. However, Steven Renders has built a Mini Report Inspector that we can integrate into our custom reports. With it we are able to view our datasets. You can find the GitHub project for the Mini Report Inspector here. In this link Steven Renders describes the Mini Report Inspector. Extremely useful!
#9 Create Regions for AL DataItems and Columns with AL Toolbox
In the extension AL Toolbox by Bart Permentier you can find another gem – the command “ALTB: Create regions for AL dataitems and columns”.
After executing the command your DataItems and Columns are “wrapped” in regions. This has the advantage that you can expand and collapse your DataItems and Columns as you like. The more complex the report, the more useful this command is.
That was it for this time. If you can think of any other tips, please comment. The more I can learn, the better 🙂