dtksh scripts are internationalized and then localized in a process similar to C applications. All strings that may be presented to the user are identified in the script. A post-processor extracts the strings from the script and, from them, builds a catalogue, which can then be translated to any desired locale. When the script executes, the current locale determines which message catalog is searched for strings to display. When a string is to be presented, it is identified by a message-set ID (corresponding to the catalog) and a message number within the set. These values determine what text the user sees. The following code illustrates the process:
# Attempt to open our message catalog catopen MSG_CAT_ID "myCatalog.cat" # The localized button label is in set 1, and is message # 2 XtCreatePushButton OK $PARENT ok \ labelString:$(catgets $MSG_CAT_ID 1 2 "OK") # The localized button label is in set 1, and is message #3 XtCreatePushButton CANCEL $PARENT cancel \ labelString:$(catgets $MSG_CAT_ID 1 3 "Cancel") # Close the message catalog, when no longer needed catclose $MSG_CAT_ID
It is important to note that the file descriptor returned by catopen must be closed using catclose and not by using the kshell exec command.