;/* Source-File: test.c				     Hello_World - LOCALIZED!

CatComp hello.cd CFILE hello_strings.h OBJFILE hello_strings.o
CatComp hello.cd hello.ct CATALOG sys:locale/Catalogs/Français/hello.catalog NOOPTIM
Quit
*/

#define CATCOMP_NUMBERS
#include "hello_strings.h"
#include <libraries/locale.h>
#include <clib/exec_protos.h>
#include <clib/locale_protos.h>
#include <pragmas/exec_pragmas.h>
#include <pragmas/locale_pragmas.h>
#include <string.h>
#include <proto/dos.h>
#include <proto/exec.h>

STRPTR	__asm GetString(register __a0 struct LocaleInfo *li, register __d0 LONG stringNum);

/* [Main-Program] **********************************************************

   This tiny localization example uses >NO< startupcode.. instead it uses 
   the dos Write() function to write the string directly to the console 
   window... so run from the CLI only!

*/

void hello(void)
{
struct Catalog *Catalog;
struct Library *LocaleBase;		// locale library base

	struct DosLibrary *DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 0L);
	Catalog=0L;
	if(LocaleBase = OpenLibrary("locale.library",38)) Catalog=OpenCatalogA(NULL,"hello.catalog",NULL);

	Write(Output(), GetCatalogStr(Catalog,MSG_HELLO,"Hello World!\n"), strlen(GetCatalogStr(Catalog,MSG_HELLO,"Hello World!\n")));

	if(Catalog)	CloseCatalog(Catalog);		/* Close Locale catalog */
	if(LocaleBase)	CloseLibrary(LocaleBase); 	/* Close Locale library */
	if(DOSBase)	CloseLibrary((struct Library *)DOSBase); /* Close DOS Library */
}

