/* Prototypes */
#include <clib/locale_protos.h>
#include <clib/dos_protos.h>

/* Pragmas */
#ifdef AZTEC_C
#include <pragmas/locale_lib.h>
#endif /*   AZTEC_C		    */

#if defined(__SASC)  ||  defined(_DCC)  ||  defined(__MAXON__)
#include <pragma/locale_lib.h>     
#endif	/*  __SASC  ||	_DCC  ||  __MAXON__	*/

#ifdef __GNUC__
#include <inline/locale.h>
#endif	/*  __GNUC__	*/

static LONG fax_Version = 0;
static const STRPTR fax_BuiltInLanguage = (STRPTR) "english";

struct FC_Type
{   LONG   ID;
    char *Str;
};

/* Definitions */
const struct FC_Type _MSG_AppDescription = { 0, "Desk for Multifax 3.0 © by TKR" };
const struct FC_Type _MSG_AppCopyright = { 1, "© by Jürgen Späth" };
const struct FC_Type _MSG_Fax_Win = { 2, "MultiFax V 1.8 © 1996 J. Späth" };
const struct FC_Type _MSG_MNlabel1Projekt = { 3, "Project" };
const struct FC_Type _MSG_MNlabel1ber = { 4, "about" };
const struct FC_Type _MSG_MNlabel1berChar = { 5, "ü_" };
const struct FC_Type _MSG_MNlabel1Beenden = { 6, "End" };
const struct FC_Type _MSG_MNlabel1BeendenChar = { 7, "e_" };
const struct FC_Type _MSG_BT_Printer = { 8, "_Printer-Server" };
const struct FC_Type _MSG_BT_Spooler = { 9, "_Fax-Spooler" };
const struct FC_Type _MSG_BT_Logbook = { 10, "_Logbook" };
const struct FC_Type _MSG_BT_Config = { 11, "_Configuration" };
const struct FC_Type _MSG_BT_Desktop = { 12, "De_sk" };
const struct FC_Type _MSG_BT_End = { 13, "_End" };
const struct FC_Type _MSG_Info_Win = { 14, "Info" };
const struct FC_Type _MSG_TX_ueber = { 15, "\nThe ultimative\n\nMulti-Fax-Desk\n\nShearware\n\n\0330 \033b© by Jürgen Späth\n\n\033n at 2. May 1996\n\nMUI © by Stefan Stuntz\n\033b&\n\033n  MUI-Builder © by Eric Totel  \n" };
const struct FC_Type _MSG_BT_OK = { 16, "o\00OK" };
static struct Catalog *fax_Catalog = NULL;

void OpenAppCatalog(struct Locale *loc, STRPTR language)
{
	LONG tag, tagarg;
	extern struct Library *LocaleBase;
	extern void CloseAppCatalog(void);

	CloseAppCatalog(); /* Not needed if the programmer pairs OpenAppCatalog
			and CloseAppCatalog right, but does no harm.  */

	if (LocaleBase != NULL  &&  fax_Catalog == NULL)
	{
	if (language == NULL)
		tag = TAG_IGNORE;
	else
	{
		tag = OC_Language;
		tagarg = (LONG) language;
	}
	fax_Catalog = OpenCatalog(loc, (STRPTR) "fax.catalog",
			OC_BuiltInLanguage, fax_BuiltInLanguage,
			tag, tagarg,
			OC_Version, fax_Version,
			TAG_DONE);
	}
}

void CloseAppCatalog(void)
{
	if (LocaleBase)        
		CloseCatalog(fax_Catalog);
	fax_Catalog = NULL;
}

char * GetFaxString(APTR fcstr)
{
	char *defaultstr;
	LONG strnum;

	strnum = ((struct FC_Type *) fcstr)->ID;
	defaultstr = ((struct FC_Type *) fcstr)->Str;

	return(fax_Catalog ? (char *)GetCatalogStr(fax_Catalog, strnum, defaultstr) :
			defaultstr);
}
