A while ago I had the need to translate labels, I was creating eMail bodys while using SysMailer and wanted to use different languages for different customers.
I found the class SysLabel and tried to use it. But the problem was that this didn´t work. I allways got the string in the language that was set up under Tools/Options.
print SysLabel::labelId2String2("@SYS54971", "en-us");
I usually have Swedish setup as language when I run Dynamics AX, and this is the result when running previous code.
Aktiveringsdatum
If there are any english readers: “Aktiveringsdatum” is the Swedish translation of “Activation date“.
I traced the code and found out that the label converts to it’s string before it´s sent into the method labelId2String2. Since the input value wasn’t a labelId anymore, the method just returned the exact string that was sent in.
I found a solution to this problem by piecing together the labelname in the call to the method. It seems that the label didn’t convert to it’s string when I did it this way.
str labelStringSwedish;
str labelStringEngUS;
;
labelStringSwedish =
SysLabel::labelId2String2("@"+"SYS54971", "en-us");
labelStringEngUS =
SysLabel::labelId2String2("@"+"SYS54971", "sv");
print labelStringSwedish;
print labelStringEngUS;
pause;
Result:
Aktiveringsdatum
Activation date
Some of you might have noticed that I use the method labelId2String2, therefore there should also exist a method named labelId2String. This is true, the difference between this two methods is not a big one.
· labelId2String - Returns an empty string if an invalid labelId is used in the method.
· labelId2String2 - Returns the string that was sent into the method if it isn’t a valid labelId.
If a valid labelId is sent into either of these two methods, the label string is returned.
Author: Erik Paulsson
Tags: label, labelId2String, labels, language, languages, SysLabel
This entry was posted on Thursday, November 1st, 2007 at 14:42 and is filed underDevelopment, Dynamics AX, Dynamics AX 4.0. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
1 comment:
Bayağı güzel olan sikişme sahneleri var. brazzers porno her zaman daha kaliteli bir sitedir.
Post a Comment