.key BASENAME/A,CAT/S,NOCT/S,SRC/S,SD/K
.bra {
.ket }

;flexcat catalog creation script
;
;$VER: LMake V1.05 (02.10.97) Kai Norhausen (kn@tribal.line.org)
;
;just create a valid .cd [catalog description] file and run this
;script.
;
; Template: BASENAME/A,CAT/S,NOCT/S,SRC/S,SD/K
;
;           BASENAME =  The name of the project without extensions.
;                       The script will use <name>.cd and create
;                       <name>_<language>.ct and <name>.src , if
;                       specified by SRC switch
;
;           CAT      =  Create <basename>.catalog in
;                       locale:catalogs/<language>/
;
;           NOCT     =  Do not create or update catalog translation
;                       file  (.ct)
;
;           SRC      =  Activate Source creation
;
;           SD       =  Name of the FlexCat Source-Description
;                       (without .sd)
;                       This script will then create sourcecode
;                       <basename>.src
;                       (see Flexcat documentation)
;

; ################### START OF USER PREFERENCES #####################

; Specify full Path and Name of flexcat-program

Set flexname Tools:FlexCat/Flexcat

; Flexcat options for catalog creation (see flexcat.guide)

Set flexopts FLUSH FILL

; ###################  END OF USER PREFERENCES  #####################

FailAt 21
Set minver 1
Set minrev 9

; Works with FlexCat x.y+ only
C:Version >NIL: $flexname VERSION $minver REVISION $minrev
If WARN
   Echo "Sorry, you need FlexCat $minver.$minrev or above"
   UnSet minrev
   UnSet minver
   UnSet flexname
   UnSet flexopts
   Quit 10
EndIf

;Setup
Set basename {basename}                  ;name of program
Set catbase LOCALE:catalogs              ;home Path of catalogs
Set catdir $catbase/$language            ;add dirname

;update/create  <basename>.ct  [catalog-translation]
If {NOCT} NOT EQ "NOCT"
   If Exists $basename_$language.ct
      Echo "Updating $basename_$language.ct .... " NOLINE
      $flexname $basename.cd $basename_$language.ct NEWCTFILE $basename_$language.ct
   Else
      Echo "Creating $basename_$language.ct .... " NOLINE
      $flexname $basename.cd newctfile $basename_$language.ct
   EndIf
   If WARN
      Echo "FAILED"
      Quit 10
   EndIf
   Echo "OK"
EndIf

;create <basename>.catalog
If {cat} EQ "CAT"
   Echo "Creating $basename.catalog .... " NOLINE
   $flexname $basename.cd $basename_$language.ct CATALOG $catdir/$basename.catalog $flexopts
   If WARN
      Echo "FAILED"
      Quit 10
   EndIf
   Echo "OK"
EndIf

;Source creation process
If {src} EQ "SRC"
   If {sd} NOT GT ""
      Echo "No source-description specified."
      Quit 10
   Else
      Echo "Creating Source  .... " NOLINE
      $flexname $basename.cd $basename.src={SD}.sd     ;create source
      If WARN
         Echo "FAILED"
         Quit 10
      EndIf
      Echo "OK"
   EndIf
EndIf

;clean up and exit
UnSet flexname
UnSet flexopts
UnSet basename
UnSet catdir
UnSet catbase
UnSet minver
UnSet minrev
Quit

