Monday, December 21, 2009

How to set the language used on a report

When printing a report, Ax sets the used language automatically based on the user's settings. The selection of available languages for the client interface depends on the installed language license keys.

But sometimes, it may be necessary to change the default settings for reports. With reports needed for external use for example. Like invoices and packings slips you send to your customers. These documents require to be made up in the language of your customer. Ax is designed with this scenario in mind.

The language to use in the report can be set with following command:

element.design().languageID();

So for example:

element.design().languageID('en-us');


Place the code in the init method of your report, or in the fetch method.


You can use this in your own custom reports as well, with no limitation regarding the language license keys you bought. All you need are the appropriate label files. (Otherwise you get error messages like 'label @SYS123 not found in language xyz'.)

Got some time to spare? It can be fun to see how your documents look like in he - Hebrew, with its right to left printing.

3 comments:

  1. nice work! :D

    I blogged a few days ago about a way to automatically translate labels with web services in AX. Only a small experiment but may be you should be interested in take a look ;)

    http://www.jaestevan.com/2009.10/traduccion.automatica.de.etiquetas.con.bing

    Blog is in spanish but the xpo attached file is english docummented too.

    ReplyDelete
  2. Hello
    I'm working in hebrew, and I set the language of my report to EN-US
    the labels appear in english, but the report is still right-to-left instead of switching to left-to-right

    ReplyDelete