/* Dieses Programm demonstriert das Handling mit der
 * Locale-Library und gibt diverse Informationen
 * über die eingestellte Sprache aus. 
 * Verwendeter C-Compiler: SAS-C 6.5x
 */
#include <exec/types.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/locale.h>
#include <proto/utility.h>
#include <stdio.h>

struct Library *LocaleBase=NULL;
struct Locale *locale;

VOID main(ULONG argc, char **argv)
{
  ULONG stringid;
  /* Nur vom CLI zu starten */
  if( argc ) {
    /* Versionsnummer 38 ist eigentlich überflüssig, da
     * die Locale-Library sowieso erst ab WB 2.1 (V38)
     * vorhanden ist */
    LocaleBase=OpenLibrary("locale.library",38);
    if( LocaleBase ) {
      locale=OpenLocale(NULL);
      if( locale ) {
        printf("Eingestellte Sprache: %s\n",
                locale->loc_LanguageName);
        printf("Landes-Code=%ld\nTelefonVorwahl=%ld\n",
                              locale->loc_CountryCode, 
                              locale->loc_TelephoneCode);
        printf("Währungseinheit=%s\nKleine Einheit=%s\n",
                              locale->loc_MonCS, 
                              locale->loc_MonSmallCS);
        /* Die 51 vorbesetzten Texte auslesen */
        for( stringid=1; stringid <= 50; stringid++ )
          printf("String[%d]=\"%s\"\n",stringid,
                       GetLocaleStr(locale,stringid));
        CloseLocale( locale );
      } else printf("Fehler beim Öffnen der Locale\n");
      CloseLibrary(LocaleBase);
    } else printf("Locale-Library nicht vorhanden\n");
  }
}
