Optimal approach to Labels Management
You might be working on any ISV Solution, where it may be required to create labels in non-English languages. Or in any other language.
One way to translate original labels into other lanaguge is to go one by one for each label and your developer creates new label for every single text. That is of course very tough exercise, in terms of spending too much time; because usually a normal sized ISV solution can have thousands of labels.
An easy solution to do this is to prepare all of your labels in one excel file and import those in a single click. Sounds good right? How to do that, lest see.
Prepare a file in following format
Label Id | Language ID | Label Text | Lable Long Description | LableFileId |
@PMS2873 | nl | dutch Label Text | dutch label Long Description | PMS |
Label Id: The label id of existing label. When you developed ISV solution that moment may be you were using EN-US labels, so, now you might want to translate your solution into NL/Dutch; for previously created labels in en-us you already got Label Id(S). Those old label Id(s), you will refer here to create translation for those into any new lanaguge
Language Id: each lanaguge in AX is represented by an id such as en-us for English. NL for Dutch, and so on. Specify language, for which you want to create label. In example above we have selected nl, which is Dutch language, we already have English for these labels in our system.
Label Text: Text of your label.
Label Description: Description of label.
LabelFieldId: The three chars of Label File, for which you want to create labels.
Fill this file of excel, and ask your developer to write code. It will read that file and will create translation for each label text, In needed lanaguge. Using same file, you can create Labels of any lanaguge, simply on one click.
Here goes the code, which will create labels, of other lanaguge.
SysLabelEdit SysLabelEdit; LabelId varLabelId= literalStr('@PMS2873'); ; SysLabelEdit = new SysLabelEdit(); SysLabelEdit.labelModify('nl',varLabelId,"My Label in Duth","My Label Description in Dutch",SysLabelApplModule::None); info("Ok");
Also if it’s needed to create a new label by code, you can do it as under.
SysLabelEdit SysLabelEdit; LabelId varLableId; SysLabelEdit = new SysLabelEdit(); varLableId = SysLabelEdit.labelInsert('nl','sample label text','sample label long description',SysLabelApplModule::None,'PMS'); info(strFmt('Lable Created: %1',varLableId));
*This post is locked for comments