/* Prototypes */
#ifdef __GNUC__
#include <proto/locale.h>
#include <proto/dos.h>
#else
#include <proto/locale.h>
#include <clib/dos_protos.h>

extern struct Library *LocaleBase;

#endif /* __GNUC__ */



static LONG FreedomExplorer_Version = 0;
static const STRPTR FreedomExplorer_BuiltInLanguage = (STRPTR) "english";

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

/* Definitions */
const struct FC_Type _MSG_AppDescription = { 0, "Freedom Module for check actual call" };
const struct FC_Type _MSG_AppCopyright = { 1, "Lithium Software 2000" };
const struct FC_Type _MSG_JanelaPrincipal = { 2, "By SuRRouND 2k" };
const struct FC_Type _MSG_MNlabel1Project = { 3, "Project" };
const struct FC_Type _MSG_MNlabel1About = { 4, "About" };
const struct FC_Type _MSG_MNlabel1AboutChar = { 5, "A " };
const struct FC_Type _MSG_MNlabel1AboutMUI = { 6, "About MUI" };
const struct FC_Type _MSG_MNlabel1AboutMUIChar = { 7, "U " };
const struct FC_Type _MSG_MNlabel1BarLabel0 = { 8, "BarLabel0" };
const struct FC_Type _MSG_MNlabel1Iconified = { 9, "Iconified" };
const struct FC_Type _MSG_MNlabel1IconifiedChar = { 10, "I " };
const struct FC_Type _MSG_MNlabel1Exit = { 11, "Exit" };
const struct FC_Type _MSG_MNlabel1ExitChar = { 12, "E " };
const struct FC_Type _MSG_MNlabel1Settings = { 13, "Settings" };
const struct FC_Type _MSG_MNlabel1LoadConfiguration = { 14, "Load Configuration..." };
const struct FC_Type _MSG_MNlabel1LoadConfigurationChar = { 15, "L " };
const struct FC_Type _MSG_LabelPrincipal = { 16, "  Freedom Explore Call V1.02  " };
const struct FC_Type _MSG_LabelConnectTitle = { 17, "Connect" };
const struct FC_Type _MSG_LabelOnlineTitle = { 18, "Online" };
const struct FC_Type _MSG_LabelCostTitle = { 19, "Cost" };
const struct FC_Type _MSG_LabelStatusCallTitle = { 20, "Status" };
const struct FC_Type _MSG_LabelStatusCall = { 21, "\nNot Connected..." };
const struct FC_Type _MSG_BotaoExit = { 22, "_Exit" };
const struct FC_Type _MSG_BotaoIconified = { 23, "_Iconified" };
const struct FC_Type _MSG_BotaoUpdate = { 24, "_Update" };
const struct FC_Type _MSG_JanelaMsg = { 25, "Janela de Mensagens" };
const struct FC_Type _MSG_Msg01 = { 26, "\033cYou have an unregistered version\n\0338Please, send register form!\nRegister is a free e-mail" };
const struct FC_Type _MSG_Msg02 = { 27, "_Ok" };
const struct FC_Type _MSG_Msg03 = { 28, "Freedom Database directory not found! Look Freedom prefs!" };
const struct FC_Type _MSG_Msg04 = { 29, "Not connected...\n\0338You need to connect on web!\033n" };
const struct FC_Type _MSG_Msg05 = { 30, "FreeEventMiami event log not found!\n\0338Read FreeEventMiami Install Guide!\033n" };
const struct FC_Type _MSG_Msg06 = { 31, "---" };
const struct FC_Type _MSG_Msg07 = { 32, "\033cFreedom Call needs Assign!\0338\nInsert in your user-startup [Assign Freedom: Freedom directory] " };
const struct FC_Type _MSG_JanelaAbout = { 33, "About..." };
const struct FC_Type _MSG_AboutBotaoOk = { 34, "_Ok" };

extern void CloseAppCatalog(void);

static struct Catalog *FreedomExplorer_Catalog = NULL;

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

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

	if (FreedomExplorer_Catalog == NULL)
	{
		if (language == NULL)
			tag = TAG_IGNORE;
		else
		{
			tag = OC_Language;
			tagarg = (LONG) language;
		}
		FreedomExplorer_Catalog = OpenCatalog(loc, (STRPTR) "FreedomExplorer.catalog",
			OC_BuiltInLanguage,(LONG)FreedomExplorer_BuiltInLanguage,
			tag, tagarg,
			OC_Version, FreedomExplorer_Version,
			TAG_DONE);
	}
}

void CloseAppCatalog(void)
{
	CloseCatalog(FreedomExplorer_Catalog);
	FreedomExplorer_Catalog = NULL;
}

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

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

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