Basic Principle

For objects used by internationally active companies, multilingual support must be planned from the beginning. The key component is a selection parameter that controls the active language:

GDL
! Language parameter (user parameter) 
! int_language ! Type: Integer
! 1 = German, 2 = English, etc. 

Variant 1 – Named Individual Variables

Each term to be translated gets its own variable:

GDL
! German 
IF int_language = 1 THEN 
    _durchgangsbreite = "Durchgangsbreite" 
    _durchgangshoehe = "Durchgangshöhe" 
ENDIF 
! English 
IF int_language = 2 THEN 
    _durchgangsbreite = "Egress Width" 
    _durchgangshoehe = "Egress Height" 
ENDIF

Macro call:

GDL
CALL "translation_object.gsm" PARAMETERS RETURNED_PARAMETERS _durchgangsbreite, _durchgangshoehe
  • Advantage: Very good readability when using variables in the script
  • Disadvantage: High script volume – each variable must be declared individually as RETURNED_PARAMETERS

Variant 2 – Indexed Array

All translations go into a two-dimensional array:

GDL
! German 
IF int_language = 1 THEN 
_translation[1][1] = "Durchgangsbreite" 
_translation[1][2] = "Durchgangshöhe" 
ENDIF 
! English 
IF int_language = 2 THEN 
_translation[2][1] = "Egress Width" 
_translation[2][2] = "Egress Height" 
ENDIF

Macro call:

GDL
CALL "translation_object.gsm" PARAMETERS     RETURNED_PARAMETERS _translation
  • Advantage: Compact script, short macro commands
  • Disadvantage: Poor readability – the content of _translation[2][1] is not immediately clear

Note: For many terms, it is recommended to organize and comment the indices thematically, e.g. by UI texts, VALUES entries, labels, etc.


The cleanest and most maintainable solution uses nested dictionaries.
The translation macro (translation_object.gsm) contains the DICT parameter dict_words and the following master script:

GDL
! -----------------------------------------------------------------------!
DICT local
! -----------------------------------------------------------------------!

IF int_language = 1 THEN
    local.de.aktuell       = "aktuell?"
    local.de.handbuch      = "Handbuch"
    local.de.bugs          = "Bugs"
    local.de.wuensche      = "Wünsche"
ENDIF

IF int_language = 2 THEN
    local.en.aktuell       = "Up to date?"
    local.en.handbuch      = "Manual"
    local.en.bugs          = "Bugs"
    local.en.wuensche      = "Wishes"
ENDIF


! ---------------------------------------------------------------------- !

DICT dict_words

IF int_language = 1 THEN dict_words = local.de
IF int_language = 2 THEN dict_words = local.en

PARAMETERS dict_words = dict_words

!GOTO "Masterend"

END dict_words

! ---------------------------------------------------------------------- !

Macro call and usage in the main object, which also contains the DICT parameter dict_words:

GDL
DICT local

CALL "translation_object.gsm" PARAMETERS int_language = int_language
    RETURNED_PARAMETERS dict_words

! Usage in script:
TEXT2 0, 0, dict_words.handbuch
TEXT2 0, 1, dict_words.wuensche
  • Readability: Key name makes content immediately clear: dict_words.handbuch
  • Expandability: New languages or terms can be added without structural changes
  • Maintainability: All translations centralized in the macro, main script remains untouched
  • Compactness: A single RETURNED_PARAMETERS dict_words is sufficient