##stringtype C
##shortstrings
/*
**	Locale.c
**
**	Copyright (C) 1994,95 Bernardo Innocenti
**
**	Routines to handle localization.
**
**	This file was created automatically by `FlexCat V1.5'
**	Do NOT edit by hand!
*/

#include <libraries/locale.h>

#include <clib/exec_protos.h>
#include <clib/locale_protos.h>

#include <pragmas/exec_sysbase_pragmas.h>
#include <pragmas/locale_pragmas.h>

#include "XModule.h"


#define CATALOGVERSION	%v
#define CATALOGNAME		"%b.catalog"
#define MSG_COUNT		%n


STRPTR AppStrings[] =
{
	%s%(,)
};

struct Library			*LocaleBase = NULL;
struct Catalog			*Catalog = NULL;



void SetupLocale (void)
{
	/* Try to open locale.library */
	if (LocaleBase = OpenLibrary ("locale.library", 38L))
	{
		/* Try to get catalog for current language */
  		if (Catalog = OpenCatalog (NULL, CATALOGNAME,
			OC_BuiltInLanguage,	"english",
			OC_Version,			CATALOGVERSION,
			TAG_DONE))
		{
			/* Read in locale language strings */
			UBYTE **as = AppStrings;
			ULONG i;

			/* Get translation strings */
			for (i = 0; i < MSG_COUNT; i++, as++)
			*as = GetCatalogStr (Catalog, i, *as);
		}
	}
}



void CleanupLocale (void)
{
	if (LocaleBase)
	{
		CloseCatalog (Catalog);	/* No need to check for NULL */
		CloseLibrary (LocaleBase);
	}
}
