D365FO Labels & translation help

The question I received today from a student in the MB-500 training was: ‘Can you show me how to create labels, and is there an easy way to translate labels in bulk?’ So, this blog is a step-by-step guide for creating labels in Dynamics 365 Finance and Operations and how to easily translate them with the help of some Excel Macros.

Open Visual Studio:

  • Start Visual Studio (as administrator) and open your Dynamics 365 Finance and Operations project.

Create a new label file:

  • Right-click on your project in the Solution Explorer.
  • Select Add > New Item.
  • Choose Labels under Dynamics 365 Items and give your label file a name.

Add a new label:

  • Open the label file you just created.
  • Right-click in the label file and select New Label.
  • Fill in the required fields, such as the label ID, the language, and the text of the label.

Save the label file:

  • Save your changes by clicking Save or using the shortcut Ctrl+S.

Use the label in your code:

  • Open the code where you want to use the label. For example: create a runnable class and info the newly created labels.
  • example reference to the label `@LabelFile:LabelID`.

Compile and deploy:

  • Compile your project to ensure there are no errors.
  • Deploy your changes to the Dynamics 365 environment.

Translate to different languages: Open the “en-US”  label file. check the relative Uri in Model Store property in your project, where the label file is stored.

Then copy the content of the text file into Excel, but skip the line with label 0.

Paste the label content in the Excel translation help, in the worksheet “original” in column A. Then execute the macro “SplitColumnA”.

Copy the values of Column C to the worksheet “translate”, in Column D.

Define the source language “en” and target language “nl”.

Then copy the translation method in Column F, for as many cells as Column D has data. Use this code (without ‘).

‘=Translate($D2;$B$2;$B$3)

Paste the translated values into worksheet “original” in Column E. And execute the macro “MergeColumnBandE”.

Last but not the least, copy the values from Column G back into the language file.

Download the translation Excel file with Macros.