lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Translating tempo marks -- scheme question


From: Mark Polesky
Subject: Re: Translating tempo marks -- scheme question
Date: Fri, 19 Dec 2008 12:53:15 -0800 (PST)

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 "|."
}







reply via email to

[Prev in Thread] Current Thread [Next in Thread]