Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development

> ## Using the API calls translatePhrase and getTranslation

> Use the `translatePhrase` function call to access a text translation. This function returns translations for base text strings one at a time, as shown:

>     DYNAMIC-FUNCTION(“translatePhrase”:U IN gshTranslationManager,
>         INPUT pcText,
>         INPUT pdLanguageObj )

> The `translatePhrase` function takes these parameters:

> - `INPUT pcText (CHARACTER)` — The base text string (in the original language) that you want to have translated.

> - `INPUT pdLanguageObj (DECIMAL)` — The object ID key of the Language table record for the language to be translated into. You can retrieve this object ID, if you need it, using the `currentLanguageObj` property, which the Session Manager maintains and can return to you with the `getPropertyList` API call.

> - `RETURNS (CHARACTER)` — The function returns the translated string.

> The `translatePhrase` function is basically a simplified version of the `getTranslation` call, which you can use when you need more than text strings translated, as shown:

>     RUN getTranslation IN gshTranslationManager
>         ( INPUT pdLanguageObj,
>           INPUT pcObjectName,
>           INPUT pcWidgetType,
>           INPUT pcWidgetName,
>           INPUT pdWidgetEntry,
>           OUTPUT pcOriginalLabel,
>           OUTPUT pcTranslatedLabel,
>           OUTPUT pcOriginalTooltip,
>           OUTPUT pcTranslatedTooltip )

> The `getTranslation` procedure takes these parameters:

> - `INPUT pdLanguageObj (DECIMAL)` — The object ID of the `Language` table record identifying the target language. The default is 0 for the current login language.

> - `INPUT pcObjectName (CHARACTER)` — The name of the application object being translated. This can be an actual object name or it can be blank, in which case the translation that applies to all objects of the widget type (in effect the default value) is returned. This field should also be blank if you’re retrieving a text translation.

> - `INPUT pcWidgetType (CHARACTER)` — This can be one of the following strings: `title`, `browse`, `fill-in`, `radio-set`, `text`, `button`, `toggle-box`, `combo-box`, `slider`, or `editor`. Setting the widget type and widget name both to`title` is a special case for window title translation.

> - `INPUT pcWidgetName (CHARACTER)` — A window title, a text value, or a widget label.

> - `INPUT pdWidgetEntry (INTEGER)` — The widget entry number is used for radio set items.

> - `OUTPUT pcOriginalLabel (CHARACTER)` — The widget label in the original language is returned in this `OUTPUT` parameter.

> - `OUTPUT pcTranslatedLabel (CHARACTER)` — The translated widget label is returned in this `OUTPUT` parameter. Text translations are also returned in this parameter.

> - `OUTPUT pcOriginalTooltip (CHARACTER)` — If this is a widget that supports ToolTips, the ToolTip in the original language is returned in this `OUTPUT` parameter.

> - `OUTPUT pcTranslatedTooltip (CHARACTER)` — The ToolTip translation, if any, is returned in this `OUTPUT` parameter.

Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095