
/*FS*//* ------------------------------- include -------------------------------- */

#ifdef XXX_OPTIONAL
/* locale support */
#define CATCOMP_ARRAY
#include "directory_texts.h"

struct Strings
{
   LONG s_ID;
   STRPTR s_String;
};

#include <clib/locale_protos.h>
#include <pragmas/locale_pragmas.h>

#ifdef __SASC
#define LocaleBase      cb->cb_LocaleBase
#else
struct Library *LocaleBase = NULL;
#endif
#endif

#include "classbase.h"

/*FE*/

/*FS*/ BOOL UserClassBaseInit(struct ClassBase *cb)
{
#ifdef XXX_OPTIONAL
   LocaleBase    = OpenLibrary("locale.library"   ,39);
   if(LocaleBase != NULL)
      cb->cb_Catalog = OpenCatalog(NULL,"xxxdt.catalog",
				   OC_BuiltInLanguage,"english",
				   TAG_DONE);
   cb->cb_Strings    = (struct Strings *) CatCompArray;
   cb->cb_StringsEnd = cb->cb_Strings + (sizeof(CatCompArray)/sizeof(struct CatCompArrayType));
#endif

   return TRUE;
}
/*FE*/
/*FS*/ void UserClassBaseClean(struct ClassBase *cb)
{
#ifdef XXX_OPTIONAL
   if(cb->cb_Catalog != NULL)
      CloseCatalog(cb->cb_Catalog);
   CloseLibrary(LocaleBase);
#endif
}
/*FE*/

/* -------------------------------- locale -------------------------------- */
#ifdef XXX_OPTIONAL
/*FS*/ STRPTR GetString(struct ClassBase *cb,LONG id)
{
   struct Strings *str = cb->cb_Strings;

   while(str < cb->cb_StringsEnd)
   {
      if(str->s_ID == id)
	 return GetCatalogStr(cb->cb_Catalog,id,str->s_String);
      str++;
   }

   return "";
}
/*FE*/
#endif

