/******************************************************************************
** Localize.c
*******************************************************************************
**
** description:
**
** This file contains functions to localize GALer.
**
******************************************************************************/
 




/********************************* includes **********************************/
 
#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"





/********************************** defines **********************************/



 

/******************************** functions **********************************/





/******************************** variables **********************************/

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

extern  struct  AppString AppStrings[];

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

extern  struct  NewMenu   MainMenu[];
extern  struct  NewMenu   CheckerMenu[];


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

extern  char    *cmps[4];







/******************************************************************************
** LocalizeText()
*******************************************************************************
** input:   none
** output:  none
**
** remarks: localize text
******************************************************************************/

void LocalizeText(void)
{
    int n;

    if (LocaleBase && catalog)
    {
        for (n = 0; n <= LAST_LOCALISATION_STR; n++)
            AppStrings[n].as_Str = GetCatalogStr(catalog, n,
                                                 AppStrings[n].as_Str);
    }   


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

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

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

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

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



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

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

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

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

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

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



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

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

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

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

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

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

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

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

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



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

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



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

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

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

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

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

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

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



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

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

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

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

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

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

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

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





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

    cmps[0] = AppStrings[MSG_CMP_GALGAL2].as_Str;     /* comparison ratio */
    cmps[1] = AppStrings[MSG_CMP_GALJED2].as_Str;     /* buttons          */
    cmps[2] = AppStrings[MSG_CMP_JEDGAL2].as_Str;
    cmps[3] = NULL;




    /***************** 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(ErrorLineStr, AppStrings[MSG_ERRLINE].as_Str);

}


