/****************************************************************/
/*								*/
/* Localize.c - this file includes the localisation		*/
/* 								*/
/****************************************************************/


#include <exec/types.h>
#include <graphics/displayinfo.h>
#include <libraries/gadtools.h>
#include <libraries/locale.h>
#include <string.h>

#include <proto/locale.h>

#include "Localize.h"




extern	struct  AppString { LONG   as_ID;
		 	    STRPTR as_Str;
			  };

extern	struct  AppString AppStrings[];

extern	struct	Catalog	   *catalog;
extern	struct	LocaleBase *LocaleBase;

extern	struct	NewMenu   MainNewMenu[];
extern	struct	NewMenu	  PrueferNewMenu[];
extern	struct	NewGadget OptNGad[];
extern	struct	NewGadget RAsm16NGad[], RAsm20NGad[], AsmNGad[];
extern	struct	NewGadget WriteNGad[], JEDNGad[], SelectEditorNGad[];

extern	struct	IntuiText WriteIText1, WriteIText2, WriteIText3;
extern	struct	IntuiText AsmITxt1, JEDITxt1;


extern	UBYTE	*CmpText1, *CmpText2, *CmpText3, *CmpText4;
extern	UBYTE	OptTxt1[];
extern	UBYTE	ErrorLineStr[];



/* localize text
**
*/
void LocalizeText(void)
{
int n;

  if (LocaleBase && catalog) {

    for (n = 0; n <= 324; n++)
      AppStrings[n].as_Str = GetCatalogStr(catalog, n, AppStrings[n].as_Str);

  }


/************************* localize menus ***************************/
	/* Project menu */
MainNewMenu[ 0].nm_Label   = AppStrings[MSG_MAIN_MENU1].as_Str;

MainNewMenu[ 1].nm_Label   = AppStrings[MSG_MAIN_MENU1_ITEM1].as_Str;

MainNewMenu[ 2].nm_Label   = AppStrings[MSG_MAIN_MENU1_ITEM2].as_Str;

MainNewMenu[ 6].nm_Label   = AppStrings[MSG_MAIN_MENU1_ITEM3].as_Str;

MainNewMenu[ 8].nm_Label   = AppStrings[MSG_MAIN_MENU1_ITEM5].as_Str;
MainNewMenu[ 8].nm_CommKey = AppStrings[MSG_MAIN_MENU1_ITEM5_COMMKEY].as_Str;



	/* GAL-Type menu */
MainNewMenu[ 9].nm_Label   = AppStrings[MSG_MAIN_MENU2].as_Str;

MainNewMenu[10].nm_Label   = AppStrings[MSG_MAIN_MENU2_ITEM1].as_Str;
MainNewMenu[10].nm_CommKey = AppStrings[MSG_MAIN_MENU2_ITEM1_COMMKEY].as_Str;

MainNewMenu[11].nm_Label   = AppStrings[MSG_MAIN_MENU2_ITEM2].as_Str;
MainNewMenu[11].nm_CommKey = AppStrings[MSG_MAIN_MENU2_ITEM2_COMMKEY].as_Str;

MainNewMenu[12].nm_Label   = AppStrings[MSG_MAIN_MENU2_ITEM3].as_Str;
MainNewMenu[12].nm_CommKey = AppStrings[MSG_MAIN_MENU2_ITEM3_COMMKEY].as_Str;

MainNewMenu[13].nm_Label   = AppStrings[MSG_MAIN_MENU2_ITEM4].as_Str;
MainNewMenu[13].nm_CommKey = AppStrings[MSG_MAIN_MENU2_ITEM4_COMMKEY].as_Str;

MainNewMenu[15].nm_Label   = AppStrings[MSG_MAIN_MENU2_ITEM6].as_Str;



	/* GAL menu */
MainNewMenu[16].nm_Label   = AppStrings[MSG_MAIN_MENU3].as_Str;

MainNewMenu[17].nm_Label   = AppStrings[MSG_MAIN_MENU3_ITEM1].as_Str;
MainNewMenu[17].nm_CommKey = AppStrings[MSG_MAIN_MENU3_ITEM1_COMMKEY].as_Str;

MainNewMenu[18].nm_Label   = AppStrings[MSG_MAIN_MENU3_ITEM2].as_Str;

MainNewMenu[19].nm_Label   = AppStrings[MSG_MAIN_MENU3_ITEM3].as_Str;

MainNewMenu[20].nm_Label   = AppStrings[MSG_MAIN_MENU3_ITEM4].as_Str;

MainNewMenu[21].nm_Label   = AppStrings[MSG_MAIN_MENU3_ITEM5].as_Str;
MainNewMenu[21].nm_CommKey = AppStrings[MSG_MAIN_MENU3_ITEM5_COMMKEY].as_Str;

MainNewMenu[22].nm_Label   = AppStrings[MSG_MAIN_MENU3_ITEM6].as_Str;

MainNewMenu[23].nm_Label   = AppStrings[MSG_MAIN_MENU3_ITEM7].as_Str;

MainNewMenu[25].nm_Label   = AppStrings[MSG_MAIN_MENU3_ITEM9].as_Str;



	/* GAL-Assembler menu */
MainNewMenu[26].nm_Label   = AppStrings[MSG_MAIN_MENU4].as_Str;

MainNewMenu[27].nm_Label   = AppStrings[MSG_MAIN_MENU4_ITEM1].as_Str;
MainNewMenu[27].nm_CommKey = AppStrings[MSG_MAIN_MENU4_ITEM1_COMMKEY].as_Str;



	/* GAL-Disassembler */
MainNewMenu[28].nm_Label   = AppStrings[MSG_MAIN_MENU5].as_Str;

MainNewMenu[29].nm_Label   = AppStrings[MSG_MAIN_MENU5_ITEM1].as_Str;

MainNewMenu[30].nm_Label   = AppStrings[MSG_MAIN_MENU5_ITEM2].as_Str;

MainNewMenu[31].nm_Label   = AppStrings[MSG_MAIN_MENU5_ITEM3].as_Str;
MainNewMenu[31].nm_CommKey = AppStrings[MSG_MAIN_MENU5_ITEM3_COMMKEY].as_Str;

MainNewMenu[33].nm_Label   = AppStrings[MSG_MAIN_MENU5_ITEM5].as_Str;
MainNewMenu[33].nm_CommKey = AppStrings[MSG_MAIN_MENU5_ITEM5_COMMKEY].as_Str;

MainNewMenu[34].nm_Label   = AppStrings[MSG_MAIN_MENU5_ITEM6].as_Str;

MainNewMenu[36].nm_Label   = AppStrings[MSG_MAIN_MENU5_ITEM8].as_Str;
MainNewMenu[36].nm_CommKey = AppStrings[MSG_MAIN_MENU5_ITEM8_COMMKEY].as_Str;



	/* Tools menu */
MainNewMenu[37].nm_Label   = AppStrings[MSG_MAIN_MENU6].as_Str;

MainNewMenu[38].nm_Label   = AppStrings[MSG_MAIN_MENU6_ITEM1].as_Str;

MainNewMenu[39].nm_Label   = AppStrings[MSG_MAIN_MENU6_ITEM2].as_Str;

MainNewMenu[40].nm_Label   = AppStrings[MSG_MAIN_MENU6_ITEM3].as_Str;
MainNewMenu[40].nm_CommKey = AppStrings[MSG_MAIN_MENU6_ITEM3_COMMKEY].as_Str;

MainNewMenu[42].nm_Label   = AppStrings[MSG_MAIN_MENU6_ITEM5].as_Str;
MainNewMenu[42].nm_CommKey = AppStrings[MSG_MAIN_MENU6_ITEM5_COMMKEY].as_Str;

MainNewMenu[44].nm_Label   = AppStrings[MSG_MAIN_MENU6_ITEM7].as_Str;

MainNewMenu[45].nm_Label   = AppStrings[MSG_MAIN_MENU6_ITEM8].as_Str;
MainNewMenu[45].nm_CommKey = AppStrings[MSG_MAIN_MENU6_ITEM8_COMMKEY].as_Str;

MainNewMenu[47].nm_Label   = AppStrings[MSG_MAIN_MENU6_ITEM10].as_Str;



	/* Checker menu */
PrueferNewMenu[0].nm_Label   = AppStrings[MSG_CHECKER_MENU1].as_Str;

PrueferNewMenu[1].nm_Label   = AppStrings[MSG_CHECKER_MENU1_ITEM1].as_Str;
PrueferNewMenu[1].nm_CommKey = AppStrings[MSG_CHECKER_MENU1_ITEM1_COMMKEY].as_Str;



/************************* localize gadgets ***************************/

/* gadgets for Optimizer */
OptNGad[0].ng_GadgetText = AppStrings[MSG_OPT_USE_GAD].as_Str;
OptNGad[1].ng_GadgetText = AppStrings[MSG_OPT_REJECT_GAD].as_Str;

/* gadgets for Reassembler */
RAsm16NGad[20].ng_GadgetText = AppStrings[MSG_CANCEL_GAD].as_Str;
RAsm16NGad[21].ng_GadgetText = AppStrings[MSG_CONT_GAD].as_Str;
RAsm16NGad[22].ng_GadgetText = AppStrings[MSG_CLEAR_GAD].as_Str;
RAsm16NGad[23].ng_GadgetText = AppStrings[MSG_SET_GAD].as_Str;

RAsm20NGad[24].ng_GadgetText = AppStrings[MSG_CANCEL_GAD].as_Str;
RAsm20NGad[25].ng_GadgetText = AppStrings[MSG_CONT_GAD].as_Str;
RAsm20NGad[26].ng_GadgetText = AppStrings[MSG_CLEAR_GAD].as_Str;
RAsm20NGad[27].ng_GadgetText = AppStrings[MSG_SET_GAD].as_Str;

AsmNGad[0].ng_GadgetText = AppStrings[MSG_MAKEJED_GAD].as_Str;
AsmNGad[1].ng_GadgetText = AppStrings[MSG_MAKEFUSE_GAD].as_Str;
AsmNGad[2].ng_GadgetText = AppStrings[MSG_MAKECHIP_GAD].as_Str;
AsmNGad[3].ng_GadgetText = AppStrings[MSG_MAKEPIN_GAD].as_Str;
AsmNGad[4].ng_GadgetText = AppStrings[MSG_AUTOSAVE_GAD].as_Str;
AsmNGad[5].ng_GadgetText = AppStrings[MSG_ADJUSTGAL_GAD].as_Str;
AsmNGad[6].ng_GadgetText = AppStrings[MSG_CONT_GAD].as_Str;
AsmNGad[7].ng_GadgetText = AppStrings[MSG_CANCEL_GAD].as_Str;


/* gadgets for write access */
WriteNGad[0].ng_GadgetText = WriteNGad[2].ng_GadgetText = WriteNGad[4].ng_GadgetText =
	AppStrings[MSG_BLANKTEST_GAD].as_Str;

WriteNGad[1].ng_GadgetText = WriteNGad[3].ng_GadgetText =
		AppStrings[MSG_VERIFY_GAD].as_Str;

WriteNGad[5].ng_GadgetText = AppStrings[MSG_OK_GAD].as_Str;


/* gadgets for JEDEC */
JEDNGad[0].ng_GadgetText = AppStrings[MSG_JEDSEC_GAD].as_Str;
JEDNGad[1].ng_GadgetText = AppStrings[MSG_JEDFUSE_GAD].as_Str;
JEDNGad[2].ng_GadgetText = AppStrings[MSG_JEDFILE_GAD].as_Str;
JEDNGad[3].ng_GadgetText = AppStrings[MSG_OK_GAD].as_Str;


/* gadgets for editor selection */
SelectEditorNGad[0].ng_GadgetText = AppStrings[MSG_EDITOR].as_Str;
SelectEditorNGad[1].ng_GadgetText = AppStrings[MSG_WBTOFRONT].as_Str;
SelectEditorNGad[2].ng_GadgetText = AppStrings[MSG_OK_GAD].as_Str;



/***************** localize text pointers and strings *****************/


CmpText4 = (UBYTE *)AppStrings[MSG_CMP_CANCEL].as_Str;

CmpText3 = (UBYTE *)AppStrings[MSG_CMP_SIGEQUAL].as_Str;

CmpText2 = (UBYTE *)AppStrings[MSG_CMP_NOTEQUAL].as_Str;

CmpText1 = (UBYTE *)AppStrings[MSG_CMP_EQUAL].as_Str;


strcpy(OptTxt1, AppStrings[MSG_OPT_EQUNUM].as_Str);

strcpy(ErrorLineStr, AppStrings[MSG_ERRLINE].as_Str);


WriteIText3.IText = AppStrings[MSG_ERASE_ITXT].as_Str;
WriteIText2.IText = AppStrings[MSG_COPY_ITXT].as_Str;
WriteIText1.IText = AppStrings[MSG_PROG_ITXT].as_Str;


AsmITxt1.IText = AppStrings[MSG_WRITEFILES_ITXT].as_Str;
JEDITxt1.IText = AppStrings[MSG_WRITEJED_ITXT].as_Str;


}


