Label Files
The term label in Dynamics AX refers to a localizable text resource, used throughout the product as messages to the user, form control labels, column headers,Help text in the status bar, captions on forms, and text on Web forms, to name just a few places. Labels are localizable, meaning that they can be translated into most languages
All text resources are kept in a Unicode-based label file that must have a three-letter identifier. The label file is located in the application folder (Program Files\Microsoft Dynamics AX\50\Application\Appl\Standard) and follows this naming convention:
Ax
The following are two examples, the first showing U.S. English and the second a Danish label file:
Axsysen-us.ALD
Axtstda.ALD
Each text resource in the label file has a 32-bit integer label ID, label text, and an optional label description. The structure of the label file is very simple:
@<Label file identifier>
[Label description]
Below figure shows Label file opened in Microsoft Notepad showing a few labels from the en-us label file
Axsysen-us.ALD
Axtstda.ALD
@<Label file identifier>
[Label description]
This simple structure allows for localization outside Dynamics AX using third-party tools.
After the localized label files are in place, the user can choose a language in the Options dialog box. When the language is changed, the user must close and restart the Dynamics AX client.
You can create new label files by using the Label File Wizard, which you access from the Microsoft Dynamics AX drop-down menu by clicking Tools\Development Tools\Wizards\Label File Wizard. The wizard guides you through the steps for adding a new label file or a new language to an existing label file. After you run the wizard, the label file is ready to use.
Note
-
When naming a label file, choose a three-letter ID that has a high chance of being unique, such as your company’s initials. Don’t choose the name of the layer, such as VAR or USR. Eventually, you’ll likely merge two separately developed features into the same installation, a task that will be more difficult if the label files collide.
-
Creating a New Label
You use the Label Editor to create new labels. You can start it using any of the following procedures:
- Clicking Tools\Development Tools\Label\Label Editor from the Microsoft Dynamics AX drop-down menu
- Clicking the Lookup Label/Text button on the X++ code editor toolbar
- Clicking the Lookup button on text properties in the property sheet
The Label Editor (shown in Figure L) allows you to find existing labels. Reusing a label is often preferable to creating a new one. You can create a new label by pressing Ctrl+N or by clicking the New button.
Figure L. Label Editor
In addition to allowing you to find and create new labels, the Label Editor can also show where a label is used. It also logs any changes to each label.
-
When reusing a label, make sure that the label meaning is what you intend it to be in all languages. Some words are homonyms, meaning words that have many meanings, and they naturally translate into many different words in other languages. For example, the English word can is both a verb and a noun. The description column describes the intended meaning of the label.
-
Referencing Labels from X++
In the MorphX design environment, labels are referenced in the format @<LabelFileIdentifier> <LabelID>. If you don’t want a label reference to automatically convert to the label text, you can use the literalStrfunction. When a placeholder is needed to display the value of a variable, you can use the strFmt function and a string containing %n, where n> = 1. Placeholders can also be used within labels. The following code shows a few examples.
// prints: Time transactions
print "@SYS1";
// prints: @SYS1
print literalStr("@SYS1");
// prints: Microsoft Dynamics is a Microsoft brand
print strFmt("%1 is a %2 brand", "Microsoft Dynamics", "Microsoft");
-
-
Note
When naming a label file, choose a three-letter ID that has a high chance of being unique, such as your company’s initials. Don’t choose the name of the layer, such as VAR or USR. Eventually, you’ll likely merge two separately developed features into the same installation, a task that will be more difficult if the label files collide.
Figure L. Label Editor
When reusing a label, make sure that the label meaning is what you intend it to be in all languages. Some words are homonyms, meaning words that have many meanings, and they naturally translate into many different words in other languages. For example, the English word can is both a verb and a noun. The description column describes the intended meaning of the label.
// prints: Time transactions
print "@SYS1";
// prints: @SYS1
print literalStr("@SYS1");
// prints: Microsoft Dynamics is a Microsoft brand
print strFmt("%1 is a %2 brand", "Microsoft Dynamics", "Microsoft");