Developing for Dynamics GP

by David Musgrave (Perth, WA, Australia) and the Microsoft Dynamics GP Developer Support Team (Fargo, ND, USA)

Handling Translation when Customizing with VBA

Handling Translation when Customizing with VBA

  • Comments 2

David MeegoFrom the Translating Dexterity Applications Series

The final topic in the series is one that was added later after I was asked about how to handle translated applications when writing customizations.

Most code would work fine as it is independent of the language. However, it is common in Visual Basic for Applications (VBA) customizations to read the prompt from a dialog using the Window_AfterModalDialog() event and take action based on the prompt text.  On a translated system this text will differ.

The solution is that you would need to look for the prompt in each language.  You can use a select case statement as shown in the US English versus International English example below:

VBA Code Example

The easiest method of capturing the exact text to use is by placing a breakpoint at the beginning of the select case statement. Then once the code is paused, use the immediate window to type "? PromptString" and then press Enter.  You can the cut and paste the prompt into the code.

Advanced Method: If you want to try a more advanced method, it would be possible to get the message resource (if you know the Message ID) from Dexterity using passthrough sanScript and returning the result to the SY_User_Object_Store (SY90000) DUOS table and then reading the DUOS from VBA. This example demonstrates the techniques involved: Hybrid - Changing Screen Colours Depending on Company Example. Comparing against the message from Dexterity itself will always work regardless of language.

This is a good method of having a single set of code that will work for all languages. However, it is likely that each language is going to have its own application folder and so you can have separate code for each language as well.

Have fun customizing.

David

Page 1 of 1 (2 items)
Comments Information

PLEASE READ BEFORE POSTING

Please only post comments relating to the topic of this page.

If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.

Leave a Comment
  • Please add 4 and 4 and type the answer here:
  • Post