Hello,I’m experimenting with an implementation of automatic tagline language selection and currently have two problems with the void function \language that I adapted from music-functions-init.ly: – I can’t get the first, optional argument to work; it needs to be explicitly given or Lily will take the string as first argument – although it’s required to be a symbol. – The define in the second clause to cond doesn’t work: there are two errors due to output-language being an unbound variable.
Help! :-) Simon PS: A short note on the intended design of the function: I want to achieve that \language input "deutsch" only sets the note names language, \language output "deutsch" only selects the german tagline and \language "deutsch" or \language general "deutsch" does both. (See discussion on ly-bug)
\version "2.19.16" language = #(define-void-function (parser location channel language) ((symbol? 'general) string?) (_i "Define languages for input (i.e. set note names for @var{language}), output (i.e. display tagline and table of contents in @var{language}), or both.") ;(display (not (eq? channel 'input))) (cond ((not (eq? channel 'output)) (note-names-language parser language)) ((not (eq? channel 'input)) (define output-language (string->symbol language))) )) \language general "deutsch" #(format #t "Output language has been defined as ~a" output-language) englishTaglineText = #(format #f "Music typeset using LilyPond ~a~awww.lilypond.org" (lilypond-version) (ly:wide-char->utf-8 #x2014) ;; 2014 = em dash. ) germanTaglineText = #(format #f "Noten gesetzt mit LilyPond ~a ~a www.lilypond.org" (lilypond-version) (ly:wide-char->utf-8 #x2013) ;;2013 = en dash. ) #(define taglines `( (deutsch . ,germanTaglineText) (english . ,englishTaglineText) )) #(define-markup-command (format-tagline layout props text) (markup?) (interpret-markup layout props #{ \markup { \pad-to-box #'(0 . 0) #'(0 . 3) { \with-url #"http://lilypond.org/" $text } } #})) tagline = \markup \format-tagline #(let ((tagl (assoc-get output-language taglines))) (if tagl tagl (begin (ly:warning (format #f "Tagline for ~a not defined, using English." (symbol->string output-language))) (assoc-get 'english taglines)))) \header { } { h'1 }
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user