Neil Puttock wrote:
> More streamlining, since the dictionary is an alist:
> 
> #(define (getLocalized items word)
>    (assoc-get word items word))
> 

While we're at it, we might as well replace
(list '(a . b) '(c . d)) with '((a . b) (c . d)):

#(define tempi
  '(("Adagio" . "Повільно")
    ("Allegro" . "Швидко")
    ; etc-etc, let's say ...
  ))

and make an identifier:
filler = { \repeat "unfold" 2 { c4 c c c } \break }

- Mark
________________________________________________________

\version "2.11.65-1"

% here is a "dictionary":
#(define tempi
  '(("Adagio" . "Повільно")
    ("Allegro" . "Швидко")))

% a function to get localized word -- if list does not
% contain translated variant, untranslated word returned.
#(define (getLocalized items word)
  (assoc-get word items word))

#(define-markup-command (ukr layout props word) (string?)
  (interpret-markup layout props
    (markup (getLocalized tempi word))))

filler = { \repeat "unfold" 2 { c4 c c c } \break }

\relative c'' {
  \tempo \markup { \ukr #"Allegro" } \filler
  \tempo \markup { \ukr #"Adagio" } \filler
  \tempo \markup { \ukr #"Allegretto" } \filler
  \tempo \markup \concat { \null \ukr #"Allegretto" } \filler
  \tempo \markup { \ukr #"Adagio" } \filler

  \bar "|."
}





_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to