
FlexCat source in ARexx programs
================================

Let's have a look at Arexx.sd, the source description for  localised  Arexx
programs  {which  is  a  fully  functional  program  to  show the useage of
localisation, so you have to replace everything between "INSERT  YOUR  CODE
HERE" and "END OF YOUR CODE" with your own code.}


/* Arexx.sd  ARexx locale support */

TRUE = 1 ; FALSE = 0
locale = TRUE ; DEF_LOC = FALSE

IF ~Show('L',"locale.library") THEN
   IF ~AddLib("locale.library",0,-30) THEN DO
      SAY "No locale support"
      locale = FALSE
   END

CALL DefineLocaleStrings   /* set defaults */

cat = OpenCatalog("%b.catalog","%l",%v)  /* open catalog */

IF cat = 0 THEN
   SAY "Error: Could not use localized strings. Using defaults instead."


/* INSERT YOUR CODE HERE */

   /* Example: Print out all available catalog strings */
   SAY "%d:" GetLocStr(%i)

/* END OF YOUR CODE */



CALL CloseCatalog(cat)
EXIT

/* ############## Subroutines ############### */

GetLocStr:                             /* get a localized string */
   ARG id .
   locstr = GetCatalogStr(cat,id,defstr.id)
RETURN locstr

DefineLocaleStrings:                   /* define default strings */
   IF DEF_LOC = TRUE THEN RETURN

   /* identifiers */
   %i = %d

   /* default strings */
   defstr.%i = %s

   DEF_LOC = TRUE

RETURN
