Saturday, 16 January 2010

AX - Change language at runtime

Last week I got a request to write a report in a different language.
Instead of creating new labels. You can change the language at runtime using the infolog.language() method.
static void TestDiffLanguage(Args _args)
{
    ;
    info("@SYS22548");
    infolog.language('de');
    info("@SYS22548");
    infolog.language('En-US');
    info("@SYS22548");
    infolog.language('ar');
    info("@SYS22548");
    infolog.language('En-AU');
}
I used it in the header and footer methods of the report.

Warning: This will change you system language. Make sure you set back to your own language at the end.

No comments: