File: language.scm

package info (click to toggle)
sdc 1.0.8beta-8
  • links: PTS
  • area: contrib
  • in suites: slink
  • size: 1,400 kB
  • ctags: 874
  • sloc: lisp: 8,120; ansic: 967; makefile: 671; perl: 136; sh: 50
file content (78 lines) | stat: -rw-r--r-- 1,692 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

(define words-en 
'(
  ( intro . "Introduction")
  ( abstract . "Abstract")
  ( author . "Author")
  ( here . "[here]" )
  ( content . "Contents" )
  ( bibl . "Bibliography" )
  ( figure . "Figure")
  ( table . "Table" )
  ( footnote . "Footnote" )
  ( footnotes . "Footnotes" )
  ( preface . "Preface" )
  ( chapt . "Chapter" )
  ( appendix . "Appendix" )
  ( index . "Index" )
  ( page . "page" )
  ( Q: . "Q: " )
  ( A: . "A: " )
))

(define words-de
'(( intro . "Einleitung")
  ( abstract . "Zusammenfassung")
  ( author . "Autor")
  ( here . "[hier]" )
  ( content . "Inhalt" )
  ( bibl . "Literatur")
  ( figure . "Abbildung" )
  ( table . "Tabelle" )
  ( footnote . "Funote" )
  ( footnotes . "Funoten" )
  ( preface . "Vorwort" )
  ( chapt . "Kapitel" )
  ( appendix . "Anhang" )
  ( index . "Index" )
  ( page . "Seite" )
  ( Q: . "Q: " )
  ( A: . "A: " )
))

; translate one word to the current language
; should be improved somtime

(define language-word-list '())
(define doc-lang "DE" )

(define (set-lang! args)
  (let* ((pp (assv 'LANG args))
	 (pl (if pp (cdr pp) #f)))
    (if pl
	(begin 
	  (set! doc-lang  pl)
	  (set! language-word-list 
		(cond
		 ((equal? pl "EN") words-en)
		 ((equal? pl "DE") words-de)))))))

(define (lw w)
  (let ((p (assq w language-word-list)))
    (if p
	(cdr p)
	(begin (warn 1 `(#"\nWarning: Word for " ,w " unknown."))
	""))))

(define (phrase lang)
  (let ((words
	 (cond
	  ((equal? lang "DE") words-de)
	  ((equal? lang "EN") words-en)
	  (else (message 0 "Language \"" lang "\" not defined in language.scm")
		words-en))))
    (lambda (phrase)
      (let ((p (assq phrase words)))
	(if p
	    (cdr p)
	    (symbol->string phrase))))))