/****************************************************************
***
*** Main c file for locale
***
*** This file has been generated by Localizer 1.0
***
*****************************************************************/

#include <libraries/locale.h>
#include <proto/locale.h>

static LONG CatVersion = 1;

extern struct Library *LocaleBase;

struct LocStr
{
    LONG   ID;
    STRPTR Str;
};

const struct LocStr _ERR_400 = {0,"Bad request"};
const struct LocStr _ERR_401 = {1,"Unauthorized"};
const struct LocStr _ERR_402 = {2,"Payment required"};
const struct LocStr _ERR_403 = {3,"Forbidden"};
const struct LocStr _ERR_404 = {4,"Not found"};
const struct LocStr _ERR_405 = {5,"Method not allowed"};
const struct LocStr _ERR_406 = {6,"Not acceptable"};
const struct LocStr _ERR_407 = {7,"Proxy authentication required"};
const struct LocStr _ERR_408 = {8,"Request timeout"};
const struct LocStr _ERR_409 = {9,"Conflict"};
const struct LocStr _ERR_410 = {10,"Gone"};
const struct LocStr _ERR_411 = {11,"Length required"};
const struct LocStr _ERR_412 = {12,"Precondition failed"};
const struct LocStr _ERR_413 = {13,"Request entity too large"};
const struct LocStr _ERR_414 = {14,"Request-URL too long"};
const struct LocStr _ERR_415 = {15,"Unsupported media type"};
const struct LocStr _ERR_416 = {16,"Requested range not valid"};
const struct LocStr _ERR_419 = {17,"Expectation failed"};
const struct LocStr _ERR_500 = {18,"Internal server error"};
const struct LocStr _ERR_501 = {19,"Not implemented"};
const struct LocStr _ERR_502 = {20,"Bad gateway"};
const struct LocStr _ERR_503 = {21,"Service unavailable"};
const struct LocStr _ERR_504 = {22,"Gateway timeout"};
const struct LocStr _ERR_505 = {23,"HTTP version not supported"};
const struct LocStr _ERR_506 = {24,"Redirection failed"};
const struct LocStr _ERR_CONNECT = {25,"Connect error!"};
const struct LocStr _ERR_GENERIC400 = {26,"Generic 4xx error (Bad request)"};
const struct LocStr _ERR_GENERIC500 = {27,"Generic 5xx error (Internal server error)"};
const struct LocStr _ERR_INTERNAL = {28,"Internal error: %d"};
const struct LocStr _ERR_PCLOSED = {29,"Connection prematurely closed"};
const struct LocStr _ERR_SEND = {30,"Sending request error!"};
const struct LocStr _ERR_UNKMSG = {31,"Unknown number message: %d"};
const struct LocStr _HTTP_CONNECTED = {32,"Connected"};
const struct LocStr _HTTP_CONNECTING = {33,"Connecting to %s\n"};
const struct LocStr _HTTP_CONNECTRETRY = {34,"Retrying to connect..."};
const struct LocStr _HTTP_NMODIFIED = {35,"Not modified"};
const struct LocStr _HTTP_RECEIVED = {36,"Received: %%ld of %ld"};
const struct LocStr _HTTP_RECEIVEDU = {37,"Received: %%ld of (unknown)"};
const struct LocStr _HTTP_RECEIVING = {38,"Receiving header..."};
const struct LocStr _HTTP_RECVDATA = {39,"Receiving data..."};
const struct LocStr _HTTP_REDIRECT = {40,"Redirect to: %s"};
const struct LocStr _HTTP_SENDING = {41,"Sending request..."};

static struct Catalog *Catalog = NULL;

/******************************************************************************/
void OpenCat(struct Locale *);
void CloseCat(void);
STRPTR GetString(APTR);

/******************************************************************************/

void OpenCat(struct Locale * Loc)
{
    if(LocaleBase != NULL && Catalog == NULL)
    {
        Catalog=OpenCatalog(Loc,(STRPTR)"HTTP_Downloader.catalog",
                            OC_BuiltInLanguage,"english",
                            OC_Version,CatVersion,
                            TAG_DONE);
    }
}

void CloseCat(void)
{
    if(LocaleBase!=NULL)
    {
        CloseCatalog(Catalog);
    }
    Catalog=NULL;
}

STRPTR GetString(APTR CatStr)
{
    STRPTR DefStr;
    LONG StrNum;

    StrNum=((struct LocStr *)CatStr)->ID;
    DefStr=((struct LocStr *) CatStr)->Str;

    return(Catalog ? GetCatalogStr(Catalog,StrNum,DefStr) : DefStr);
}
