Re: Enhancement: automatically translate tagline
On Wed, Mar 25, 2015 at 9:58 AM, Simon Albrecht simon.albre...@mail.de wrote: please open a tracker issue for this thread. I’m going to make another essay at coding something sensible. Done, Simon : Issue 4337 - https://code.google.com/p/lilypond/issues/detail?id=4337 Ralph ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Enhancement: automatically translate tagline
Hello Bug Squad, please open a tracker issue for this thread. I’m going to make another essay at coding something sensible. Yours, Simon Am 16.03.2015 um 12:13 schrieb Simon Albrecht: Am 16.03.2015 um 10:22 schrieb David Kastrup: Simon Albrecht simon.albre...@mail.de writes: Thanks for elaborating, Harm. That’s some elegant coding with which I couldn’t have come up :-) Am 15.03.2015 um 19:22 schrieb Thomas Morley: [snip] \version 2.19.16 %% Please note, \language has to be declared before 'used-language' %% is done or included, (if stored elsewhere) \language deutsch %\language english %% if no tagline for a language is defined, default-english will be printed %\language catalan %% TODO: find better method to detect which language is actually used #(define used-language (car (find (lambda (e) (eq? (cdr e) (ly:parser-lookup parser 'pitchnames))) language-pitch-names))) I imagine that a generic solution worth being included in the code base would require this definition to be made through the \language command itself. I don't think it is a tenable solution to equate notename language with document language. Definitely. Or would a survey be useful on the relationship of “input and output language” in current use? After all, I have no idea on how many users actually change the defaults for both (i.e. use \language and define their own tagline and tocHeaderMarkup c.). Alternative user syntax drafts: %% document-languages = #'((input-language . dutch) (output-language . english)) %% that would be the default %% output-language might be used for other things also, e.g. table of contents. % Scenario 1: (my favourite) \language deutsch % sets both values to 'deutsch \language output italiano % sets only output-language and leaves input-language as default % two language commands would be used % in order to have different non-default settings for both % Scenario 2: \inputLanguage catalan \outputLanguage english % perhaps with \language still setting both – % or only input-language for backwards compatibility? % Shouldn’t be too difficult for convert-ly though. % mix both scenarios \language deutsch % sets only input-language for backward compatibility reasons \language output espanol % provide no command for setting both – may be easier understood then %% On naming: perhaps input-language is too wide, because all the commands and identifiers are in English anyway. Then it would better be called notename-language. I hope you agree that it’s worthwhile to make all these thoughts and that it would be good to have such functionality in an easy-to-use way. Yours Simon ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Enhancement: automatically translate tagline
Am 16.03.2015 um 13:44 schrieb Noeck: Hi, I hope you agree that it’s worthwhile to make all these thoughts and that it would be good to have such functionality in an easy-to-use way. I do agree very much. It might seem like a minor thing, but I remember when I used LilyPond for the first time many years ago, my first reaction was: The notes look nice, but this English text on an otherwise German score looks looks very unprofessional and I do think the out of the box impression counts. My impression was: That looks like any freeware would do. Fortunatelly, I found out quickly how to change the tagline and I use a custom one since then. But I support a convincing default appearance in the users language. Couldn't the language of the environment be used here? I get help and log messages in German on my system why not the tagline? I think this should be specified per file: if you want to publish a score on imslp.org, you may want an English tagline, even though you use german notenames and log messages. But perhaps this might be selected through an option, say \language local or the like. Yours, Simon ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Enhancement: automatically translate tagline
Hi Simon, Couldn't the language of the environment be used here? I get help and log messages in German on my system why not the tagline? I think this should be specified per file I am fine either way. But I care more about the default tagline here for the first impression. Mutopia has its own tagline and all of my scores have. I think it is not realistic that a tagline is found that pleases everyone, so manual settings will be frequent in any case. Cheers, Joram ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Enhancement: automatically translate tagline
Hi, I hope you agree that it’s worthwhile to make all these thoughts and that it would be good to have such functionality in an easy-to-use way. I do agree very much. It might seem like a minor thing, but I remember when I used LilyPond for the first time many years ago, my first reaction was: The notes look nice, but this English text on an otherwise German score looks looks very unprofessional and I do think the out of the box impression counts. My impression was: That looks like any freeware would do. Fortunatelly, I found out quickly how to change the tagline and I use a custom one since then. But I support a convincing default appearance in the users language. Couldn't the language of the environment be used here? I get help and log messages in German on my system why not the tagline? Cheers, Joram ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Enhancement: automatically translate tagline
Am 15.03.2015 um 17:18 schrieb Simon Albrecht: Hello, in my stylesheets, I usually include germanTagline = \markup { \italic The \italic here is my personal preference, of course. But if the appearance of the tagline is generated through a dedicated markup function, it’s most easy to adapt this. \pad-to-box #'(0 . 0) #'(0 . 3) { \with-url #http://lilypond.org/; \line { #(format #f Noten gesetzt mit LilyPond ~a ~a www.lilypond.org (lilypond-version) (ly:wide-char-utf-8 #x2013) ;;2013 = en dash. ) } } } and write \header { tagline = \germanTagline } in the score. Wouldn’t it be possible to do this automatically on the grounds of the \language command? As another approach one might provide a function which, in \header {}, allows to write \Tagline deutsch or \Tagline de or similar and thus easily choose a preset text for the desired language. I attached a draft of this, which I couldn’t get to work, unfortunately, since \displayScheme can’t handle \header blocks. I think it gives an idea, nevertheless. What do you think? Yours, Simon ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Enhancement: automatically translate tagline
Am 16.03.2015 um 10:22 schrieb David Kastrup: Simon Albrecht simon.albre...@mail.de writes: Thanks for elaborating, Harm. That’s some elegant coding with which I couldn’t have come up :-) Am 15.03.2015 um 19:22 schrieb Thomas Morley: [snip] \version 2.19.16 %% Please note, \language has to be declared before 'used-language' %% is done or included, (if stored elsewhere) \language deutsch %\language english %% if no tagline for a language is defined, default-english will be printed %\language catalan %% TODO: find better method to detect which language is actually used #(define used-language (car (find (lambda (e) (eq? (cdr e) (ly:parser-lookup parser 'pitchnames))) language-pitch-names))) I imagine that a generic solution worth being included in the code base would require this definition to be made through the \language command itself. I don't think it is a tenable solution to equate notename language with document language. Definitely. Or would a survey be useful on the relationship of “input and output language” in current use? After all, I have no idea on how many users actually change the defaults for both (i.e. use \language and define their own tagline and tocHeaderMarkup c.). Alternative user syntax drafts: %% document-languages = #'((input-language . dutch) (output-language . english)) %% that would be the default %% output-language might be used for other things also, e.g. table of contents. % Scenario 1: (my favourite) \language deutsch % sets both values to 'deutsch \language output italiano % sets only output-language and leaves input-language as default % two language commands would be used % in order to have different non-default settings for both % Scenario 2: \inputLanguage catalan \outputLanguage english % perhaps with \language still setting both – % or only input-language for backwards compatibility? % Shouldn’t be too difficult for convert-ly though. % mix both scenarios \language deutsch % sets only input-language for backward compatibility reasons \language output espanol % provide no command for setting both – may be easier understood then %% On naming: perhaps input-language is too wide, because all the commands and identifiers are in English anyway. Then it would better be called notename-language. I hope you agree that it’s worthwhile to make all these thoughts and that it would be good to have such functionality in an easy-to-use way. Yours Simon ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Enhancement: automatically translate tagline
Simon Albrecht simon.albre...@mail.de writes: Thanks for elaborating, Harm. That’s some elegant coding with which I couldn’t have come up :-) Am 15.03.2015 um 19:22 schrieb Thomas Morley: [snip] \version 2.19.16 %% Please note, \language has to be declared before 'used-language' %% is done or included, (if stored elsewhere) \language deutsch %\language english %% if no tagline for a language is defined, default-english will be printed %\language catalan %% TODO: find better method to detect which language is actually used #(define used-language (car (find (lambda (e) (eq? (cdr e) (ly:parser-lookup parser 'pitchnames))) language-pitch-names))) I imagine that a generic solution worth being included in the code base would require this definition to be made through the \language command itself. I don't think it is a tenable solution to equate notename language with document language. -- David Kastrup ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Enhancement: automatically translate tagline
Hello, in my stylesheets, I usually include germanTagline = \markup { \italic \pad-to-box #'(0 . 0) #'(0 . 3) { \with-url #http://lilypond.org/; \line { #(format #f Noten gesetzt mit LilyPond ~a ~a www.lilypond.org (lilypond-version) (ly:wide-char-utf-8 #x2013) ;;2013 = en dash. ) } } } and write \header { tagline = \germanTagline } in the score. Wouldn’t it be possible to do this automatically on the grounds of the \language command? As another approach one might provide a function which, in \header {}, allows to write \Tagline deutsch or \Tagline de or similar and thus easily choose a preset text for the desired language. I attached a draft of this, which I couldn’t get to work, unfortunately, since \displayScheme can’t handle \header blocks. I think it gives an idea, nevertheless. What do you think? Yours, Simon \version 2.19.16 \include tagline.ly \header { \Tagline de } %\void\displayScheme \header { tagline = foo } { c }\version 2.19.16 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-markup-command (format-tagline layout props text) (markup?) (interpret-markup layout props #{ \markup { \italic \pad-to-box #'(0 . 0) #'(0 . 3) { \with-url #http://lilypond.org/; \line $text } } #} )) Tagline = #(define-scheme-function (parser location id) (string?) (let ((def-tagline (lambda (ref) (define tagline (markup #:format-tagline ref) (cond ((eq? id de) (def-tagline germanTaglineText)) ((eq? id en) (def-tagline englishTaglineText)___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Enhancement: automatically translate tagline
2015-03-15 17:18 GMT+01:00 Simon Albrecht simon.albre...@mail.de: Hello, in my stylesheets, I usually include germanTagline = \markup { \italic \pad-to-box #'(0 . 0) #'(0 . 3) { \with-url #http://lilypond.org/; \line { #(format #f Noten gesetzt mit LilyPond ~a ~a www.lilypond.org (lilypond-version) (ly:wide-char-utf-8 #x2013) ;;2013 = en dash. ) } } } and write \header { tagline = \germanTagline } in the score. Wouldn’t it be possible to do this automatically on the grounds of the \language command? As another approach one might provide a function which, in \header {}, allows to write \Tagline deutsch or \Tagline de or similar and thus easily choose a preset text for the desired language. I attached a draft of this, which I couldn’t get to work, unfortunately, since \displayScheme can’t handle \header blocks. I think it gives an idea, nevertheless. What do you think? Yours, Simon How about: \version 2.19.16 %% Please note, \language has to be declared before 'used-language' %% is done or included, (if stored elsewhere) \language deutsch %\language english %% if no tagline for a language is defined, default-english will be printed %\language catalan %% TODO: find better method to detect which language is actually used #(define used-language (car (find (lambda (e) (eq? (cdr e) (ly:parser-lookup parser 'pitchnames))) language-pitch-names))) 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 { \italic \pad-to-box #'(0 . 0) #'(0 . 3) { \with-url #http://lilypond.org/; $text } } #})) #(define used-tagline (markup #:format-tagline (let ((tagl (assoc-get used-language taglines))) (if tagl tagl (assoc-get 'english taglines) \header { tagline = #used-tagline } { c''1 } HTH, Harm ___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond
Re: Enhancement: automatically translate tagline
Thanks for elaborating, Harm. That’s some elegant coding with which I couldn’t have come up :-) Am 15.03.2015 um 19:22 schrieb Thomas Morley: [snip] \version 2.19.16 %% Please note, \language has to be declared before 'used-language' %% is done or included, (if stored elsewhere) \language deutsch %\language english %% if no tagline for a language is defined, default-english will be printed %\language catalan %% TODO: find better method to detect which language is actually used #(define used-language (car (find (lambda (e) (eq? (cdr e) (ly:parser-lookup parser 'pitchnames))) language-pitch-names))) I imagine that a generic solution worth being included in the code base would require this definition to be made through the \language command itself. englishTaglineText = #(format #f Music typeset using LilyPond ~a~awww.lilypond.org http://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 http://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 { \italic \pad-to-box #'(0 . 0) #'(0 . 3) { \with-url #http://lilypond.org/; $text } } #})) #(define used-tagline (markup #:format-tagline (let ((tagl (assoc-get used-language taglines))) (if tagl tagl (assoc-get 'english taglines) \header { tagline = #used-tagline } In the attachment, I made an additional function, getTagline, to have the user select a tagline (somehow, it didn’t work with define in line 57, only if tagline was already defined and then set! applied – why?). (There’s certainly room for improvements in the coding.) Thanks Simon \version 2.19.16 %% Please note, \language has to be declared before 'used-language' %% is done or included, (if stored elsewhere) \language deutsch %\language english %% if no tagline for a language is defined, default-english will be printed %\language catalan %% TODO: find better method to detect which language is actually used #(define used-language (car (find (lambda (e) (eq? (cdr e) (ly:parser-lookup parser 'pitchnames))) language-pitch-names))) 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 { \italic \pad-to-box #'(0 . 0) #'(0 . 3) { \with-url #http://lilypond.org/; $text } } #})) #(define used-tagline (markup #:format-tagline (let ((tagl (assoc-get used-language taglines))) (if tagl tagl (assoc-get 'english taglines) tagline = #used-tagline getTagline = #(define-void-function (parser location lang) (string?) (set! tagline (markup #:format-tagline (let ((tagl (assoc-get (string-symbol lang) taglines))) (if tagl tagl (begin (ly:warning (format #f Tagline for ~a not supported, using English. lang)) (assoc-get 'english taglines)) ;(display tagline) ) \header { \getTagline deutsch } { c''1 }___ bug-lilypond mailing list bug-lilypond@gnu.org https://lists.gnu.org/mailman/listinfo/bug-lilypond