[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Language selection code
From: |
David Nalesnik |
Subject: |
Re: Language selection code |
Date: |
Fri, 27 Mar 2015 08:38:56 -0500 |
Hi Simon,
On Thu, Mar 26, 2015 at 6:43 PM, Simon Albrecht <address@hidden>
wrote:
[...]
> So the roadmap would include
> – discussing design and coding (?)
>
I haven't gone through this thoroughly, but I did notice that an invalid
statement like this
\language general.deutsch.foo
isn't gracefully dealt with.
I haven't studied this enough to diagnose the problem, but I did notice the
following:
% extended from music-functions-init.ly:603
language =
#(define-void-function
(parser location arg)
;; Usage:
;; \language input.LANG or
;; \language output.LANG or
;; \language LANG—which is equivalent to
;; \language general.LANG or to the first two combined
(symbol-list-or-symbol?)
(_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.")
(let* ((correct-input (if (> (length arg) 2) #f #t))
(channel (if (= 2 (length arg)) ;if a channel is given,
(car arg) ;use it
'general)) ;else apply to both
(language (cond ((= 1 (length arg)) (list-ref arg 0))
((= 2 (length arg)) (list-ref arg 1))))
If correct-input is #f, language will be undefined. You could add
(else #f)
(input-lang (if language ;if input isn’t wrong
language
'nederlands)) ;default
The boolean value of #<unspecified> is ... #t, so input-lang will select
language if the input is not correct. language will be #<unspecified>.
(output-lang (if language
language
'english)))
As above.
Possibly you shouldn't bind the variables after correct-input unless the
input is correct.
HTH,
David
P.S. Thanks for working on this!