//-------------------------------------
//
// SuperCode (c) 1996 by T.Kühn 
//
// Programmiersprache:	ANSI-C
// Projektstart:			28.8.94
//
// Modul:				Locale.c
//
//-------------------------------------

/*-------------------------------------
void loc_init(char *CatName,char *language);
void loc_free();
char *CatStr(LONG StrNum);
-------------------------------------*/


#include <libraries/locale.h>
#include <pragma/locale_lib.h>

#define CATCOMP_ARRAY
#include <Struct.h>


//-------------------------------------

struct Catalog *SysCat=0;
struct Locale *locale=0;

UBYTE CatName[]="supercode.catalog";

//-------------------------------------
VOID loc_init(char *language)
{
	if (LocaleBase)
	{
		locale=OpenLocale(0);
		if (SysCat) CloseCatalog(SysCat);
		SysCat=OpenCatalog(locale,CatName,OC_Language,language,TAG_END);
	}
}
//-------------------------------------
VOID loc_free()
{
	if (SysCat)
	{
		CloseCatalog(SysCat);
		SysCat=0;
	}
	if (locale)
	{
		CloseLocale(locale);
		locale=0;
	}
}
//-------------------------------------
char *CatStr(LONG StrNum)
{
	const struct CatCompArrayType *arr=&CatCompArray[0];
	char *Str;

	while (StrNum!=arr->cca_ID)
	{
		arr++;
	}
	Str = arr->cca_Str;

	if (LocaleBase) Str=GetCatalogStr(SysCat,StrNum,Str);

	return Str;
}
//-------------------------------------

