4glWorks reference: language support routines

National language support is given in the form of text files which map tokens to phrases. Message files are organized in the source code tree in a directory per each language, and are formatted using a simple token, blanks or tabs, text scheme. Comments are marked by a pound (#) sign.
For the time being there is no provision for multiple line messages.

txt_fetch

file ctxtl.4gl
declaration
function txt_fetch(fname, code)
    define fname	char(14),
	   code		char(8)
returns description, char(80), retrieved text
purpose retrieves a line of text from a file
example none
notes
  • Should any error occur while loading the file, an error is written to the log, and depending on the error trapping routine behaviour, a message given to the user. Subsequent accesses to the same file trigger no action.
  • Text identifiers not found in the file cause the routine to return the value of code, followed by a question mark.

txt_retrieve

file ctxtl.4gl
declaration
function txt_retrieve(code)
    define code		char(14)
returns description, char(80), retrieved text
purpose txt_retrieve serves a similar purpose to txt_fetch, but gathers the output text from different places depending on the format of code:
  • an integer will return a standard Informix error message
  • a string of the form token1.token2 will retrieve message token2 from file token1
  • any other string will retrieve the corresponding text from the default message file, named <application>.txt.
example none
notes see txt_fetch

txt_validate

file ctxtl.4gl
declaration
function txt_validate(fname, codes)
    define fname	char(14),
	   codes	char(80)
returns true or false
purpose Determines whether file fname defines all the texts specified in codes
example none
notes