/* Prototypes */
#include <clib/locale_protos.h>
#include <clib/dos_protos.h>

/* Pragmas */
#ifdef AZTEC_C
#include <pragmas/locale_lib.h>
#endif /*   AZTEC_C                 */

#if defined(__SASC)  ||  defined(_DCC)  ||  defined(__MAXON__)
#include <pragma/locale_lib.h>     
#endif  /*  __SASC  ||  _DCC  ||  __MAXON__     */

#ifdef __GNUC__
#include <inline/locale.h>
#endif  /*  __GNUC__    */

static LONG rechentrainer_Version = 1;
static const STRPTR rechentrainer_BuiltInLanguage = (STRPTR) "english";

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

/* Definitions */
const struct FC_Type _MSG_AppDescription = { 0, "The Calculationtrainer for Children" };
const struct FC_Type _MSG_AppCopyright = { 1, "© by Jürgen Späth" };
const struct FC_Type _MSG_WI_Auswahl = { 2, "Calculationtrainer" };
const struct FC_Type _MSG_MNlabel1Projekt = { 3, "Project" };
const struct FC_Type _MSG_MNlabel1ber = { 4, "About" };
const struct FC_Type _MSG_MNlabel1berChar = { 5, "b_" };
const struct FC_Type _MSG_MNlabel1Punktestand = { 6, "Score" };
const struct FC_Type _MSG_MNlabel1PunktestandChar = { 7, "c_" };
const struct FC_Type _MSG_MNlabel1Beenden = { 8, "Quit" };
const struct FC_Type _MSG_MNlabel1BeendenChar = { 9, "q_" };
const struct FC_Type _MSG_MNlabel1Speichern = { 10, "Save score" };
const struct FC_Type _MSG_MNlabel1SpeichernChar = { 11, "s_" };
const struct FC_Type _MSG_MNlabel1Laden = { 12, "Load score" };
const struct FC_Type _MSG_MNlabel1LadenChar = { 13, "l_" };
const struct FC_Type _MSG_MNlabel1Rechnungsarten = { 14, "Calculation method" };
const struct FC_Type _MSG_MNlabel1AdditionNotify8 = { 15, " " };
const struct FC_Type _MSG_MNlabel1AdditionNotify9 = { 16, " " };
const struct FC_Type _MSG_MNlabel1AdditionNotify10 = { 17, " " };
const struct FC_Type _MSG_MNlabel1AdditionNotify11 = { 18, " " };
const struct FC_Type _MSG_MNlabel1AdditionNotify12 = { 19, " " };
const struct FC_Type _MSG_MNlabel1Addition = { 20, "Addition" };
const struct FC_Type _MSG_MNlabel1AdditionChar = { 21, "a_" };
const struct FC_Type _MSG_MNlabel1SubtraktionNotify8 = { 22, " " };
const struct FC_Type _MSG_MNlabel1SubtraktionNotify9 = { 23, " " };
const struct FC_Type _MSG_MNlabel1SubtraktionNotify10 = { 24, " " };
const struct FC_Type _MSG_MNlabel1SubtraktionNotify11 = { 25, " " };
const struct FC_Type _MSG_MNlabel1SubtraktionNotify12 = { 26, " " };
const struct FC_Type _MSG_MNlabel1Subtraktion = { 27, "Subtraction" };
const struct FC_Type _MSG_MNlabel1SubtraktionChar = { 28, "u_" };
const struct FC_Type _MSG_MNlabel1MultiplikationNotify8 = { 29, " " };
const struct FC_Type _MSG_MNlabel1MultiplikationNotify9 = { 30, " " };
const struct FC_Type _MSG_MNlabel1MultiplikationNotify10 = { 31, " " };
const struct FC_Type _MSG_MNlabel1MultiplikationNotify11 = { 32, " " };
const struct FC_Type _MSG_MNlabel1MultiplikationNotify12 = { 33, " " };
const struct FC_Type _MSG_MNlabel1Multiplikation = { 34, "Multiplication" };
const struct FC_Type _MSG_MNlabel1MultiplikationChar = { 35, "m_" };
const struct FC_Type _MSG_MNlabel1DivisionNotify8 = { 36, " " };
const struct FC_Type _MSG_MNlabel1DivisionNotify9 = { 37, " " };
const struct FC_Type _MSG_MNlabel1DivisionNotify10 = { 38, " " };
const struct FC_Type _MSG_MNlabel1DivisionNotify11 = { 39, " " };
const struct FC_Type _MSG_MNlabel1DivisionNotify12 = { 40, " " };
const struct FC_Type _MSG_MNlabel1Division = { 41, "Division" };
const struct FC_Type _MSG_MNlabel1DivisionChar = { 42, "d_" };
const struct FC_Type _MSG_GR_grp_0Title = { 43, "Selection" };
const struct FC_Type _MSG_BT_MultiNotify5 = { 44, "" };
const struct FC_Type _MSG_BT_MultiNotify6 = { 45, "" };
const struct FC_Type _MSG_BT_MultiNotify7 = { 46, "" };
const struct FC_Type _MSG_BT_MultiNotify8 = { 47, "" };
const struct FC_Type _MSG_BT_MultiNotify9 = { 48, "" };
const struct FC_Type _MSG_BT_MultiNotify10 = { 49, "" };
const struct FC_Type _MSG_BT_Multi = { 50, "_Multiplication" };
const struct FC_Type _MSG_BT_DiviNotify5 = { 51, "" };
const struct FC_Type _MSG_BT_DiviNotify6 = { 52, "" };
const struct FC_Type _MSG_BT_DiviNotify7 = { 53, "" };
const struct FC_Type _MSG_BT_DiviNotify8 = { 54, "" };
const struct FC_Type _MSG_BT_DiviNotify9 = { 55, "" };
const struct FC_Type _MSG_BT_DiviNotify10 = { 56, "" };
const struct FC_Type _MSG_BT_Divi = { 57, "_Division" };
const struct FC_Type _MSG_BT_AddiNotify5 = { 58, "" };
const struct FC_Type _MSG_BT_AddiNotify6 = { 59, "" };
const struct FC_Type _MSG_BT_AddiNotify7 = { 60, "" };
const struct FC_Type _MSG_BT_AddiNotify8 = { 61, "" };
const struct FC_Type _MSG_BT_AddiNotify9 = { 62, "" };
const struct FC_Type _MSG_BT_AddiNotify10 = { 63, "" };
const struct FC_Type _MSG_BT_Addi = { 64, "_Addition" };
const struct FC_Type _MSG_BT_SubtrNotify5 = { 65, "" };
const struct FC_Type _MSG_BT_SubtrNotify6 = { 66, "" };
const struct FC_Type _MSG_BT_SubtrNotify7 = { 67, "" };
const struct FC_Type _MSG_BT_SubtrNotify8 = { 68, "" };
const struct FC_Type _MSG_BT_SubtrNotify9 = { 69, "" };
const struct FC_Type _MSG_BT_SubtrNotify10 = { 70, "" };
const struct FC_Type _MSG_BT_Subtr = { 71, "_Subtraction" };
const struct FC_Type _MSG_GR_grp_1Title = { 72, "Result" };
const struct FC_Type _MSG_BT_Erg = { 73, "S_core" };
const struct FC_Type _MSG_BT_Ende = { 74, "_Quit(Esc)" };
const struct FC_Type _MSG_WI_Multiplikation = { 75, "Calculationtrainer" };
const struct FC_Type _MSG_GROUP_ROOT_1Title = { 76, "Multiplication" };
const struct FC_Type _MSG_TX_label_0 = { 77, "               How much Calculations ?                    " };
const struct FC_Type _MSG_TX_label_1 = { 78, " Term:" };
const struct FC_Type _MSG_Erg_Mul = { 79, " Result:" };
const struct FC_Type _MSG_Mul_RichtigTitle = { 80, "Right" };
const struct FC_Type _MSG_Mul_Richtig = { 81, " " };
const struct FC_Type _MSG_Mul_FalschTitle = { 82, "Wrong" };
const struct FC_Type _MSG_WI_Divi = { 83, "Calculationtrainer" };
const struct FC_Type _MSG_GROUP_ROOT_2Title = { 84, "Division" };
const struct FC_Type _MSG_TX_label_2 = { 85, "               How much Calculations ?                    " };
const struct FC_Type _MSG_TX_label_3 = { 86, " Term:" };
const struct FC_Type _MSG_Erg_Div = { 87, " Result:" };
const struct FC_Type _MSG_Div_RichtigTitle = { 88, "Right" };
const struct FC_Type _MSG_Div_FalschTitle = { 89, "Wrong" };
const struct FC_Type _MSG_WI_Addieren = { 90, "Calculationtrainer" };
const struct FC_Type _MSG_GROUP_ROOT_3Title = { 91, "Addition" };
const struct FC_Type _MSG_TX_label_4 = { 92, "               How much Calculations ?                    " };
const struct FC_Type _MSG_TX_label_5 = { 93, " Term:" };
const struct FC_Type _MSG_Erg_Addi = { 94, " Result:" };
const struct FC_Type _MSG_Addi_RichtigTitle = { 95, "Right" };
const struct FC_Type _MSG_Addi_FalschTitle = { 96, "Wrong" };
const struct FC_Type _MSG_WI_Subtraktion = { 97, "Calculationtrainer" };
const struct FC_Type _MSG_GROUP_ROOT_4Title = { 98, "Subtraction" };
const struct FC_Type _MSG_TX_label_6 = { 99, "               How much Calculations ?                    " };
const struct FC_Type _MSG_TX_label_7 = { 100, " Term:" };
const struct FC_Type _MSG_Erg_Subtr = { 101, " Result:" };
const struct FC_Type _MSG_Subtr_RichtigTitle = { 102, "Right" };
const struct FC_Type _MSG_Subtr_FalschTitle = { 103, "Wrong" };
const struct FC_Type _MSG_WI_Ergebnis = { 104, "Calculationtrainer" };
const struct FC_Type _MSG_GROUP_ROOT_5Title = { 105, "Statistic" };
const struct FC_Type _MSG_GR_grp_17Title = { 106, "Multiplication" };
const struct FC_Type _MSG_LA_label_4 = { 107, "\033c Right:" };
const struct FC_Type _MSG_LA_Label_5 = { 108, "\033c Wrong:" };
const struct FC_Type _MSG_Gauge_Mul = { 109, "%ld%" };
const struct FC_Type _MSG_GR_grp_20Title = { 110, "Division" };
const struct FC_Type _MSG_LA_label_7 = { 111, "\033c Right:" };
const struct FC_Type _MSG_LA_Label_8 = { 112, "\033c Wrong:" };
const struct FC_Type _MSG_Gauge_Div = { 113, "%ld%" };
const struct FC_Type _MSG_GR_grp_23Title = { 114, "Addition" };
const struct FC_Type _MSG_LA_label_10 = { 115, "\033c Right:" };
const struct FC_Type _MSG_LA_Label_11 = { 116, "\033c Wrong:" };
const struct FC_Type _MSG_Gauge_Addi = { 117, "%ld%" };
const struct FC_Type _MSG_GR_grp_26Title = { 118, "Subtraction" };
const struct FC_Type _MSG_LA_label_13 = { 119, "\033c Right:" };
const struct FC_Type _MSG_LA_Label_14 = { 120, "\033c Wrong:" };
const struct FC_Type _MSG_Gauge_Subtr = { 121, "%ld%" };
const struct FC_Type _MSG_GR_grp_29Title = { 122, "Overall Statistic" };
const struct FC_Type _MSG_LA_Label_16 = { 123, " Right:" };
const struct FC_Type _MSG_LA_label_17 = { 124, " Wrong:" };
const struct FC_Type _MSG_Gauge_Ges = { 125, "%ld%" };
const struct FC_Type _MSG_WI_info = { 126, "Calculationtrainer" };
const struct FC_Type _MSG_GROUP_ROOT_6Title = { 127, "Info Window" };
const struct FC_Type _MSG_TX_label_8 = { 128, "\nThe ultimative\n\nCalculationtrainer for\n\nChildren in\n\nSchoolage\n\n\0330 \033b© by Jürgen Späth\n\n\033nCompiled with © MAXON\n\n at 5.January 1996\n\nMUI © by Stefan Stuntz\n\033b&\n\033n  MUI-Builder © by Eric Totel  \n" };
const struct FC_Type _MSG_BT_Info_ok = { 129, "_OK" };
const struct FC_Type _MSG_Rubish = { 130, "\0338Rubish" };
const struct FC_Type _MSG_Right = { 131, "\0338Right !!" };
const struct FC_Type _MSG_Wrong = { 132, "\0338Wrong !!" };
const struct FC_Type _MSG_Ready = { 133, "\0338Ready !!" };
const struct FC_Type _MSG_Title = { 134, "Calculationtrainer" };
static struct Catalog *rechentrainer_Catalog = NULL;

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

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

        if (LocaleBase != NULL  &&  rechentrainer_Catalog == NULL)
        {
        if (language == NULL)
                tag = TAG_IGNORE;
        else
        {
                tag = OC_Language;
                tagarg = (LONG) language;
        }
        rechentrainer_Catalog = OpenCatalog(loc, (STRPTR) "calctrainer.catalog",
                        OC_BuiltInLanguage, rechentrainer_BuiltInLanguage,
                        tag, tagarg,
                        OC_Version, rechentrainer_Version,
                        TAG_DONE);
        }
}

void CloseAppCatalog(void)
{
        if (LocaleBase)        
                CloseCatalog(rechentrainer_Catalog);
        rechentrainer_Catalog = NULL;
}

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

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

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