]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/devel/doc-work.itexi
Merge branch 'master' into lilypond/translation
[lilypond.git] / Documentation / devel / doc-work.itexi
1 @c -*- coding: utf-8; mode: texinfo; -*-
2 @node Documentation work
3 @chapter Documentation work
4
5 @menu
6 * Introduction to documentation work::  
7 * Texinfo introduction and usage policy::  
8 * Documentation policy::        
9 * Tips for writing docs::       
10 * Updating docs with convert-ly::  
11 * Translating the documentation::  
12 @end menu
13
14
15 @node Introduction to documentation work
16 @section Introduction to documentation work
17
18 Our documentation tries to adhere to our @ref{Documentation
19 policy}.  This policy contains a few items which may seem odd.
20 One policy in particular is often questioned by potential
21 contributors: we do not repeat material in the Notation Reference,
22 and instead provide links to the @qq{definitive} presentation of
23 that information.  Some people point out, with good reason, that
24 this makes the documentation harder to read.  If we repeated
25 certain information in relevant places, readers would be less
26 likely to miss that information.
27
28 That reasoning is sound, but we have two counter-arguments.
29 First, the Notation Reference -- one of @emph{five} manuals for
30 users to read -- is already over 500 pages long.  If we repeated
31 material, we could easily exceed 1000 pages!  Second, and much
32 more importantly, LilyPond is an evolving project.  New features
33 are added, bugs are fixed, and bugs are discovered and documented.
34 If features are discussed in multiple places, the documentation
35 team must find every instance.  Since the manual is so large, it
36 is impossible for one person to have the location of every piece
37 of information memorized, so any attempt to update the
38 documentation will invariably omit a few places.  This second
39 concern is not at all theoretical; the documentation used to be
40 plagued with inconsistent information.
41
42 If the documentation were targeted for a specific version -- say,
43 LilyPond 2.10.5 -- and we had unlimited resources to spend on
44 documentation, then we could avoid this second problem.  But since
45 LilyPond evolves (and that is a very good thing!), and since we
46 have quite limited resources, this policy remains in place.
47
48 A few other policies (such as not permitting the use of tweaks in
49 the main portion of NR 1+2) may also seem counter-intuitive, but
50 they also stem from attempting to find the most effective use of
51 limited documentation help.
52
53
54
55 @node Texinfo introduction and usage policy
56 @section Texinfo introduction and usage policy
57
58 @menu
59 * Texinfo introduction::        
60 * Documentation files::         
61 * Sectioning commands::         
62 * LilyPond formatting::         
63 * Text formatting::             
64 * Syntax survey::               
65 * Other text concerns::         
66 @end menu
67
68
69 @node Texinfo introduction
70 @subsection Texinfo introduction
71
72 The language is called Texinfo; you can see its manual here:
73
74 @uref{http://www.gnu.org/software/texinfo/manual/texinfo/}
75
76 However, you don't need to read those docs.  The most important
77 thing to notice is that text is text.  If you see a mistake in the
78 text, you can fix it.  If you want to change the order of
79 something, you can cut-and-paste that stuff into a new location.
80
81 @warning{Rule of thumb: follow the examples in the existing docs.
82 You can learn most of what you need to know from this; if you want
83 to do anything fancy, discuss it on @code{lilypond-devel} first.}
84
85
86 @node Documentation files
87 @subsection Documentation files
88
89 The user manuals lives in @file{Documentation/user/}.  In
90 particular, the files @file{lilypond-learning.ly} (LM),
91 @file{lilypond.itely} (NR), @file{music-glossary.tely} (MG), and
92 @file{lilypond-program} (AU).  Each chapter is written in a
93 separate file (ending in @file{.itely} for files containing
94 lilypond code, and @file{.itexi} for files without lilypond code);
95 see the @qq{main} file for each manual to determine the filename
96 of the specific chapter you wish to modify.
97
98 Developer manuals live in @file{Documentation/devel}.  Currently
99 there is only one; @file{contrib-guide.texi}.
100
101 Although snippets are part of documentation, they are not
102 (directly) part of the manuals.  For information about how to
103 modify them, see @ref{LSR work}.
104
105
106 @node Sectioning commands
107 @subsection Sectioning commands
108
109 Most of the manual operates at the
110
111 @example
112 @@node Foo
113 @@subsubsection Foo
114 @end example
115
116 @noindent
117 level.  Sections are created with
118
119 @example
120 @@node Foo
121 @@subsection Foo
122 @end example
123
124 @itemize
125 @item
126 Please leave two blank lines above a @@node; this makes it
127 easier to find sections in texinfo.
128
129 @item
130 Sectioning commands (@@node and @@section) must not appear
131 inside an @@ignore.  Separate those commands with a space, ie @@n
132 ode.
133
134 @end itemize
135
136
137 @node LilyPond formatting
138 @subsection LilyPond formatting
139
140 @itemize
141
142 @item
143 Use two spaces for indentation in lilypond examples.  (no
144 tabs)
145
146 @item
147 All text strings should be prefaced with #.  LilyPond does
148 not strictly require this, but it is helpful to get users
149 accustomed to this scheme construct.  ie @code{\set
150 Staff.instrumentName = #"cello"}
151
152 @item
153 All engravers should have double-quotes around them:
154
155 @example
156 \consists "Spans_arpeggio_engraver"
157 @end example
158
159 Again, LilyPond does not strictly require this, but it is a useful
160 standard to follow.
161
162 @item
163 Examples should end with a complete bar if possible.
164
165 @item
166 If possible, only write one bar per line.  The notes on each
167 line should be an independent line -- tweaks should occur on their
168 own line if possible.  Bad:
169
170 @example
171 \override textscript #'padding = #3 c1^"hi"
172 @end example
173
174 Good:
175
176 @example
177 \override textscript #'padding = #3
178 c1^"hi"
179 @end example
180
181 @item
182 Most LilyPond input should be produced with:
183
184 @example
185 @@lilypond[verbatim,quote,relative=2]
186 @end example
187
188 @noindent
189 or
190
191 @example
192 @@lilypond[verbatim,quote,relative=1]
193 @end example
194
195 If you want to use \layout@{@} or define variables, use
196
197 @example
198 @@lilypond[verbatim,quote]
199 @end example
200
201 In rare cases, other options may be used (or omitted), but ask first.
202
203 @item
204 Inspirational headwords are produced with
205
206 @example
207 @@lilypondfile[quote,ragged-right,line-width=16\cm,staffsize=16]
208 @{pitches-headword.ly@}
209 @end example
210
211 @item
212 LSR snippets are linked with
213
214 @example
215 @@lilypondfile[verbatim,lilyquote,ragged-right,texidoc,doctitle]
216 @{filename.ly@}
217 @end example
218
219 @noindent
220 excepted in Templates, where `doctitle' may be omitted.
221
222 @item
223 Avoid long stretches of input code.  Noone is going to read
224 them in print.  Please create a smaller example.  (the smaller
225 example does not need to be minimal, however)
226
227 @item
228 Specify durations for at least the first note of every bar.
229
230 @item
231 If possible, end with a complete bar.
232
233 @item
234 Comments should go on their own line, and be placed before
235 the line(s) to which they refer.
236
237 @item
238 Add extra spaces around @{ @} marks; ie
239
240 @example
241 not:          \chordmode @{c e g@}
242 but instead:  \chordmode @{ c e g @}
243 @end example
244
245 @item
246 If you only have one bar per line, omit bar checks.  If you
247 put more than one bar per line (not recommended), then include bar
248 checks.
249
250 @item
251 If you want to work on an example outside of the manual (for
252 easier/faster processing), use this header:
253
254 @example
255 \paper @{
256   #(define dump-extents #t)
257   indent = 0\mm
258   line-width = 160\mm - 2.0 * 0.4\in
259   ragged-right = ##t
260   force-assignment = #""
261   line-width = #(- line-width (* mm  3.000000))
262 @}
263
264 \layout @{
265 @}
266 @end example
267
268 You may not change any of these values.  If you are making an
269 example demonstrating special \paper@{@} values, contact the
270 Documentation Editor.
271
272 @end itemize
273
274
275 @node Text formatting
276 @subsection Text formatting
277
278 @itemize
279
280 @item
281 Lines should be less than 72 characters long.  (I personally
282 recommend writing with 66-char lines, but don't bother modifying
283 existing material.)
284
285 @item
286 Do not use tabs.
287
288 @item
289 Do not use spaces at the beginning of a line (except in
290 @@example or @@verbatim environments), and do not use more than a
291 single space between words.  `makeinfo' copies the input lines
292 verbatim without removing those spaces.
293
294 @item
295 Use two spaces after a period.
296
297 @item
298 In examples of syntax, use @@var@{musicexpr@} for a music
299 expression.
300
301 @item
302 Don't use @@rinternals@{@} in the main text.  If you're
303 tempted to do so, you're probably getting too close to "talking
304 through the code".  If you really want to refer to a context, use
305 @@code@{@} in the main text and @@rinternals@{@} in the @@seealso.
306
307 @item
308 Variables or numbers which consist of a single character
309 (probably followed by a punctuation mark) should be tied properly,
310 either to the previous or the next word.  Example:
311
312 @example
313 The variable@@tie@{@}@@var@{a@} ...
314 @end example
315
316 @item
317 To get consistent indentation in the DVI output it is better
318 to avoid the @@verbatim environment.  Use the @@example
319 environment instead if possible, but without extraneous
320 indentation.  For example, this
321
322 @example
323 @@example
324   foo @{
325     bar
326   @}
327 @@end example
328 @end example
329
330 @noindent
331 should be replaced with
332
333 @example
334 @@example
335 foo @{
336   bar
337 @}
338 @@end example
339 @end example
340
341 @noindent
342 where `@@example' starts the line (without leading spaces).
343
344 @item
345 Do not compress the input vertically; this is, do not use
346
347 @example
348     Beginning of logical unit
349     @@example
350     ...
351     @@end example
352     continuation of logical unit
353 @end example
354
355 @noindent
356 but instead do
357
358 @example
359 Beginning of logical unit
360
361 @@example
362 ...
363 @@end example
364
365 @@noindent
366 continuation of logical unit
367 @end example
368
369 This makes it easier to avoid forgetting the `@@noindent'.  Only
370 use @@noindent if the material is discussing the same material;
371 new material should simply begin without anything special on the
372 line above it.
373
374 @item
375 in @@itemize use @@item
376 on a separate line like this:
377
378 @example
379 @@itemize
380 @@item
381 Foo
382
383 @@item
384 Bar
385 @end example
386
387 Do not use @@itemize @@bullet.
388
389 @item
390 To get LilyPond version, use @@version@{@} (this does not work
391 inside LilyPond snippets).  If you write "@@version@{@}" (enclosed
392 with quotes), or generally if @@version@{@} is not followed by a
393 space, tere will be an ugly line break in PDF output unless you
394 enclose it with
395
396 @example
397 @@w@{ ... @}
398
399   e.g.
400
401 @@w@{"@@version@{@}"@}
402 @end example
403
404 @end itemize
405
406
407 @node Syntax survey
408 @subsection Syntax survey
409
410 @itemize
411 @item
412 @@c - single line comments
413   "@@c NOTE:" is a comment which should remain in the final
414   version.  (gp only command ;)
415 @item
416 @@ignore ... @@end ignore - multi-line comment
417
418 @item
419 @@cindex - General index. Please add as many as you can.  Don't
420   capitalize the first word.
421 @item
422 @@funindex - is for a \lilycommand.
423
424 @item
425 @@example ... @@end ignore - example text that should be set as a
426   blockquote.  Any @{@} must be escaped with @@@{ @}@@
427 @item
428 @@itemize @@item
429 A @@item
430 B ... @@end itemize - for bulleted lists.
431   Do not compress vertically like this.
432
433 @item
434 @@code@{@} - typeset in a tt-font. Use for actual lilypond code or
435   property/context names.  If the name contains a space, wrap
436   the entire thing inside @@w@{@@code@{  @}@}.
437 @item
438 @@notation@{@} - refers to pieces of notation, e.g.
439   "@@notation@{cres.@}".  Also use to specific lyrics ("the
440   @@notation@{A - men@} is centered").  Only use once per subsection
441   per term.
442 @item
443 @@q@{@} - Single quotes. Used for `vague' terms.
444 @item
445 @@qq@{@} - Double quotes.  Used for actual quotes ("he said") or for
446   introducing special input modes.
447
448 @item
449 @@tie@{@} - Variables or numbers which consist of a single character
450   (probably followed by a punctuation mark) should be tied
451   properly, either to the previous or the next word.  Example:
452     "The letter@@tie@{@}@@q@{I@} is skipped"
453
454 @item
455 @@var - Use for variables.
456 @item
457 @@warning@{@} - produces a "Note: " box. Use for important messages.
458
459 @item
460 @@bs - Generates a backslash inside @@warning.
461     Any `\' used inside @@warning (and @@q or @@qq) must be written as `@@bs@{@}' 
462     (texinfo would also allow \\, but this breaks with PDF output).
463
464 @end itemize
465
466
467
468 @node Other text concerns
469 @subsection Other text concerns
470
471 @itemize
472
473 @item
474 References must occur at the end of a sentence, for more
475 information see @@ref@{the texinfo manual@}.  Ideally this should
476 also be the final sentence of a paragraph, but this is not
477 required.  Any link in a doc section must be duplicated in the
478 @@seealso section at the bottom.
479
480 @item
481 Introducing examples must be done with
482
483 @example
484      . (ie finish the previous sentence/paragaph)
485      : (ie `in this example:')
486      , (ie `may add foo with the blah construct,')
487 @end example
488
489 The old "sentence runs directly into the example" method is not
490 allowed any more.
491
492 @item
493 Abbrevs in caps, e.g., HTML, DVI, MIDI, etc.
494
495 @item
496 Colon usage
497
498 @enumerate
499
500 @item
501 To introduce lists
502
503 @item
504 When beginning a quote: "So, he said,...".
505
506 This usage is rarer.  Americans often just use a comma.
507
508 @item
509 When adding a defining example at the end of a sentence.
510
511 @end enumerate
512
513 @item
514 Non-ASCII characters which are in utf-8 should be directly used;
515 this is, don't say `Ba@@ss@{@}tuba' but `Baßtuba'.  This ensures
516 that all such characters appear in all output formats.
517
518 @end itemize
519
520
521
522
523 @node Documentation policy
524 @section Documentation policy
525
526 @menu
527 * Books::                       
528 * Section organization::        
529 * Checking cross-references::   
530 * General writing::             
531 * Technical writing style::     
532 @end menu
533
534 @node Books
535 @subsection Books
536
537 There are four parts to the documentation: the Learning Manual,
538 the Notation Reference, the Program Reference, and the Music
539 Glossary.
540
541 @itemize
542
543 @item
544 Learning Manual:
545
546 The LM is written in a tutorial style which introduces the most
547 important concepts, structure and syntax of the elements of a
548 LilyPond score in a carefully graded sequence of steps.
549 Explanations of all musical concepts used in the Manual can be
550 found in the Music Glossary, and readers are assumed to have no
551 prior knowledge of LilyPond.  The objective is to take readers to
552 a level where the Notation Reference can be understood and
553 employed to both adapt the templates in the Appendix to their
554 needs and to begin to construct their own scores.  Commonly used
555 tweaks are introduced and explained.  Examples are provided
556 throughout which, while being focussed on the topic being
557 introduced, are long enough to seem real in order to retain the
558 readers' interest.  Each example builds on the previous material,
559 and comments are used liberally.  Every new aspect is thoroughly
560 explained before it is used.
561
562 Users are encouraged to read the complete Learning Manual from
563 start-to-finish.
564
565
566 @item
567 Notation Reference: a (hopefully complete) description of LilyPond
568 input notation.  Some material from here may be duplicated in the
569 Learning Manual (for teaching), but consider the NR to be the
570 "definitive" description of each notation element, with the LM
571 being an "extra".  The goal is _not_ to provide a step-by-step
572 learning environment -- do not avoid using notation that has not
573 be introduced previously in the NR  (for example, use \break if
574 appropriate).  This section is written in formal technical writing
575 style.
576
577 Avoid duplication.  Although users are not expected to read this
578 manual from start to finish, they should be familiar with the
579 material in the Learning Manual (particularly ``Fundamental
580 Concepts''), so do not repeat that material in each section of
581 this book.  Also watch out for common constructs, like ^ - _ for
582 directions -- those are explained in NR 3.  In NR 1, you can
583 write: DYNAMICS may be manually placed above or below the staff,
584 see @@ref@{Controlling direction and placement@}.
585
586 Most tweaks should be added to LSR and not placed directly in the
587 .itely file.  In some cases, tweaks may be placed in the main
588 text, but ask about this first.
589
590 Finally, you should assume that users know what the notation
591 means; explaining musical concepts happens in the Music Glossary.
592
593
594 @item
595 Application Usage: information about using the program lilypond
596 with other programs (lilypond-book, operating systems, GUIs,
597 convert-ly, etc).  This section is written in formal technical
598 writing style.
599
600 Users are not expected to read this manual from start to finish.
601
602
603 @item
604 Music Glossary: information about the music notation itself.
605 Explanations and translations about notation terms go here.
606
607 Users are not expected to read this manual from start to finish.
608
609 @item
610 Internals Reference: not really a documentation book, since it is
611 automagically generated from the source, but this is its name.
612
613 @end itemize
614
615
616 @node Section organization
617 @subsection Section organization
618
619 @itemize
620
621 @item
622 The order of headings inside documentation sections should
623 be:
624
625 @example
626 main docs
627 @@predefined
628 @@endpredefined
629 @@snippets
630 @@seealso
631 @@knownissues
632 @end example
633
634 @item
635 You @emph{must} include a @@seealso.
636
637 @itemize
638 @item
639 The order of items inside the @@seealso section is
640
641 @example
642 Music Glossary:
643 @@rglos@{foo@},
644 @@rglos@{bar@}.
645
646 Learning Manual:
647 @@rlearning@{baz@},
648 @@rlearning@{foozle@}.
649
650 Notation Reference:
651 @@ruser@{faazle@},
652 @@ruser@{boo@}.
653
654 Application Usage:
655 @@rprogram@{blah@}.
656
657 Installed Files:
658 @@file@{path/to/dir/blahz@}.
659
660 Snippets: @@rlsr@{section@}.
661
662 Internals Reference:
663 @@rinternals@{fazzle@},
664 @@rinternals@{booar@}.
665 @end example
666
667 @item
668 If there are multiple entries, separate them by commas but do not
669 include an `and'.
670
671 @item
672 Always end with a period.
673
674 @item
675 Place each link on a new line as above; this makes it much easier
676 to add or remove links.  In the output, they appear on a single
677 line.
678
679 ("Snippets" is REQUIRED; the others are optional)
680
681 @item
682 Any new concepts or links which require an explanation should go
683 as a full sentence(s) in the main text.
684
685 @item
686 Don't insert an empty line between @@seealso and the first entry!
687 Otherwise there is excessive vertical space in the PDF output.
688
689 @end itemize
690
691 @item
692 To create links, use @@ref@{@} if the link is within the same
693 manual.
694
695 @item
696 @@predefined ... @@endpredefined is for commands in ly/*-init.ly
697 FIXME?
698
699 @item
700 Do not include any real info in second-level sections (ie 1.1
701 Pitches).  A first-level section may have introductory material,
702 but other than that all material goes into third-level sections
703 (ie 1.1.1 Writing Pitches).
704
705 @end itemize
706
707
708 @node Checking cross-references
709 @subsection Checking cross-references
710
711 Cross-references between different manuals are heavily used in the
712 documentation, but they are not checked during compilation.
713 However, if you compile the documentation, a script called
714 check_texi_refs can help you with checking and fixing these
715 cross-references; for information on usage, cd into a source tree
716 where documentation has been built, cd into Documentation and look
717 for check-xrefs and fix-xrefs targets in 'make help' output.  Note
718 that you have to find yourself the source files to fix
719 cross-references in the generated documentation such as the
720 Internals Reference; e.g. you can grep scm/ and lily/.
721
722
723 @node General writing
724 @subsection General writing
725
726 @itemize
727
728 @item
729 Do not forget to create @@cindex entries for new sections of text.
730 Enter commands with @@funindex, i.e.
731
732 @example
733 @@cindex pitches, writing in different octaves
734 @@funindex \relative
735 @end example
736
737 @noindent
738 do not bother with the @@code@{@} (they are added automatically).
739 These items are added to both the command index and the unified
740 index.
741
742 Both index commands should go in front of the actual material.
743
744 @@cindex entries should not be capitalized, ie
745
746 @example
747 @@cindex time signature
748 @end example
749
750 @noindent
751 is preferred instead of @qq{Time signature},   Only use capital
752 letters for musical terms which demand them, like D.S. al Fine.
753
754 For scheme functions, only include the final part, i.e.,
755
756 @example
757 @@funindex modern-voice-cautionary
758      and NOT
759 @@funindex #(set-accidental-style modern-voice-cautionary)
760 @end example
761
762 @item
763 Preferred terms:
764
765 @itemize
766
767 @item
768 In general, use the American spellings.  The internal lilypond
769 property names use this spelling.
770
771 @item
772 List of specific terms:
773
774 @example
775 canceled
776 simultaneous    NOT concurrent
777 measure: the unit of music
778 bar line: the symbol delimiting a measure   NOT barline
779 note head   NOT notehead
780 chord construct   NOT chord (when referring to <>)
781 @end example
782
783 @end itemize
784
785 @end itemize
786
787
788 @node Technical writing style
789 @subsection Technical writing style
790
791 These refer to the NR.  The LM uses a more gentle, colloquial
792 style.
793
794 @itemize
795
796 @item
797 Do not refer to LilyPond in the text.  The reader knows what the
798 manual is about.  If you do, capitalization is LilyPond.
799
800 @item
801 If you explicitly refer to @q{lilypond} the program (or any other
802 command to be executed), write @code{@@command@{lilypond@}}.
803
804 @item
805 Do not explicitly refer to the reader/user.  There is no one else
806 besides the reader and the writer.
807
808 @item
809 Avoid contractions (don't, won't, etc.).  Spell the words out completely.
810
811 @item
812 Avoid abbreviations, except for commonly used abbreviations of foreign
813 language terms such as etc. and i.e.
814
815 @item
816 Avoid fluff (@qq{Notice that,} @qq{as you can see,}
817 @qq{Currently,}).
818
819 @item
820 The use of the word @q{illegal} is inappropriate in most cases.
821 Say @q{invalid} instead.
822
823 @end itemize
824
825
826 @node Tips for writing docs
827 @section Tips for writing docs
828
829 In the NR, I highly recommend focusing on one subsection at a
830 time.  For each subsection,
831
832 @itemize
833
834 @item
835 check the mundane formatting.  Are the headings (@@predefined,
836 @@seealso, etc.) in the right order?
837
838 @item
839 add any appropriate index entries.
840
841 @item
842 check the links in the @@seealso section -- links to music
843 glossary, internal references, and other NR sections are the main
844 concern.  Check for potential additions.
845
846 @item
847 move LSR-worthy material into LSR.  Add the snippet, delete the
848 material from the .itely file, and add a @@lilypondfile command.
849
850 @item
851 check the examples and descriptions.  Do they still work?
852 @strong{Do not} assume that the existing text is
853 accurate/complete; some of the manual is highly out of date.
854
855 @item
856 is the material in the @@knownissues  still accurate?
857
858 @item
859 can the examples be improved (made more explanatory), or is there
860 any missing info?  (feel free to ask specific questions on -user;
861 a couple of people claimed to be interesting in being
862 @qq{consultants} who would help with such questions)
863
864 @end itemize
865
866 In general, I favor short text explanations with good examples --
867 @qq{an example is worth a thousand words}.  When I worked on the
868 docs, I spent about half my time just working on those tiny
869 lilypond examples.  Making easily-understandable examples is much
870 harder than it looks.
871
872
873 @subsubheading TWEAKS
874
875 In general, any \set or \override commands should go in the
876 @qq{select snippets} section, which means that they should go in
877 LSR and not the .itely file.  For some cases, the command
878 obviously belongs in the @qq{main text} (i.e. not inside
879 @@predefined or @@seealso or whatever) -- instrument names are a
880 good example of this.
881
882 @example
883 \set Staff.instrumentName = #"foo"
884 @end example
885
886 On the other side of this,
887
888 @example
889 \override Score.Hairpin #'after-line-breaking = ##t
890 @end example
891
892 clearly belongs in LSR.
893
894 I'm quite willing to discuss specific cases if you think that a
895 tweaks needs to be in the main text.  But items that can go into
896 LSR are easier to maintain, so I'd like to move as much as
897 possible into there.
898
899
900 It would be @qq{nice} if you spent a lot of time crafting nice
901 tweaks for users... but my recommendation is @strong{not} to do
902 this.  There's a lot of doc work to do without adding examples of
903 tweaks.  Tweak examples can easily be added by normal users by adding
904 them to the LSR.
905
906 One place where a documentation writer can profitably spend time writing
907 or upgrading tweaks is creating tweaks to deal with known issues.  It
908 would be ideal if every significant known issue had a workaround to avoid
909 the difficulty.
910
911
912 @node Updating docs with convert-ly
913 @section Updating doc with @command{convert-ly}
914
915 cd into Documentation and run
916
917 @example
918 find . -name '*.itely' | xargs convert-ly -e
919 @end example
920
921 @noindent
922 This also updates translated documentation.
923
924
925
926 @node Translating the documentation
927 @section Translating the documentation
928
929 @menu
930 * Getting started with documentation translation::  
931 * Documentation translation details::  
932 * Documentation translation maintenance::  
933 * Translations management policies::  
934 * Technical background::        
935 @end menu
936
937 @node Getting started with documentation translation
938 @subsection Getting started with documentation translation
939
940 First, get the sources from the Git repository, see @ref{Documentation
941 translations source code}.
942
943 @menu
944 * Translation requirements::    
945 * Which documentation can be translated::  
946 * Starting translation in a new language::  
947 @end menu
948
949 @node Translation requirements
950 @unnumberedsubsubsec Translation requirements
951
952 Working on LilyPond documentation translations requires the following
953 pieces of software, in order to make use of dedicated helper tools:
954
955 @itemize
956 @item Python 2.4 or higher,
957 @item GNU Make,
958 @item Gettext.
959 @end itemize
960
961 It is not required to build LilyPond and the documentation to
962 translate the documentation.  However, if you have enough time and
963 motivation and a suitable system, it can be very useful to build at
964 least the documentation so that you can check the output yourself and
965 more quickly; if you are interested, see @ref{Compiling from source}.
966
967 @menu
968 @end menu
969
970 @node Which documentation can be translated
971 @unnumberedsubsubsec Which documentation can be translated
972
973 The makefiles and scripts infrastructure currently supports translation
974 of the following documentation:
975
976 @itemize
977 @item documentation index (HTML);
978 @item user manual and program usage -- Texinfo source, PDF and HTML
979 output; Info output might be added if there is enough demand for it;
980 @item the News document.
981 @end itemize
982
983 The following pieces of documentation should be added soon, by
984 descending order of priority:
985
986 @itemize
987 @item automatically generated documentation: markup commands,
988 predefined music functions;
989 @item the Snippets List;
990 @item the examples page;
991 @item the Internals Reference.
992 @end itemize
993
994
995 @node Starting translation in a new language
996 @unnumberedsubsubsec Starting translation in a new language
997
998 At top of the source directory, do
999
1000 @example
1001 ./autogen.sh
1002 @end example
1003
1004 @noindent
1005 or (if you want to install your self-compiled LilyPond locally)
1006
1007 @example
1008 ./autogen.sh --prefix=$HOME
1009 @end example
1010
1011 @noindent
1012 If you want to compile LilyPond -- which is almost required to build
1013 the documentation, but is not required to do translation only -- fix
1014 all dependencies and rerun @command{./configure} (with the same
1015 options as for @command{autogen.sh}).
1016
1017 Then @command{cd} into @file{Documentation} and run
1018
1019 @example
1020 make ISOLANG=@var{MY-LANGUAGE} new-lang
1021 @end example
1022
1023 @noindent
1024 where @var{MY-LANGUAGE} is the ISO 639 language code.
1025
1026 Finally, add a language definition for your language in
1027 @file{python/langdefs.py}.
1028
1029 Before starting the real translation work, it is recommended to commit
1030 changes you made so far to Git, so e.g. you are able to get back to
1031 this state of the sources easily if needed; see @ref{Sharing your
1032 changes}.
1033
1034
1035 @node Documentation translation details
1036 @subsection Documentation translation details
1037
1038 Please follow all the instructions with care to ensure quality work.
1039
1040 All files should be encoded in UTF-8.
1041
1042 @menu
1043 * Files to be translated::      
1044 * Translating the Learning Manual and other Texinfo documentation::  
1045 * Translating the Notation Reference and Application Usage::  
1046 * Translating the Documentation index index.html.in::  
1047 @end menu
1048
1049 @node Files to be translated
1050 @unnumberedsubsubsec Files to be translated
1051
1052 @include doc-translation-list.itexi
1053
1054 @node Translating the Learning Manual and other Texinfo documentation
1055 @unnumberedsubsubsec Translating the Learning Manual and other Texinfo documentation
1056
1057 Any title which comes with one of the following commands must not be
1058 translated directly in the Texinfo source
1059
1060 @example
1061 @@node                                                   @@majorheading
1062 @@chapter       @@unnumbered          @@appendix           @@chapheading
1063 @@section       @@unnumberedsec       @@appendixsec        @@heading
1064 @@subsection    @@unnumberedsubsec    @@appendixsubsec     @@subheading
1065 @@subsubsection @@unnumberedsubsubsec @@appendixsubsubsec  @@subsubheading
1066 @@ref  @@rglos  @@ruser  @@rlearning  @@rprogram  @@rlsr
1067 @end example
1068
1069 The same applies to first argument of @code{@@r@var{manual}named}
1070 commands; however, the second argument @var{Bar baz} of
1071 @code{@@ref@{@var{Foo},@var{Bar baz},,@var{info-file}@}} and
1072 @code{@@r@var{manual}named@{@var{Foo},@var{Bar baz}@}} should be
1073 translated.
1074
1075 @code{@@uref}'s names are to be translated.
1076
1077 In any section which looks like
1078
1079 @example
1080 @@menu
1081 * @var{node1}:: @var{thing1}
1082 * @var{node2}:: @var{thing2}
1083 ...
1084 @@end menu
1085 @end example
1086
1087 @noindent
1088 the node names @var{nodeN} are @emph{not} to be translated, whereas
1089 extra title information @var{thingN} is.
1090
1091 Every node name or section title must from now on be translated
1092 separately in a @file{.po} file (just as well as LilyPond output
1093 messages) in @file{Documentation/po}.  The Gettext domain is named
1094 @code{lilypond-doc}, and unlike @code{lilypond} domain it is not
1095 managed through the Free Translation Project.
1096
1097
1098 Take care of using typographic rules for your language, especially in
1099 @file{user/macros.itexi}.
1100
1101
1102 Please keep verbatim copies of music snippets (in @code{@@lilypond}
1103 blocs).  However, some music snippets containing text that shows in
1104 the rendered music, and sometimes translating this text really helps
1105 the user to understand the documentation; in this case, and only in
1106 this case, you may as an exception translate text in the music
1107 snippet, and then you must add a line immediately before the
1108 @code{@@lilypond} block, starting with
1109
1110 @example
1111 @@c KEEP LY
1112 @end example
1113
1114 @noindent
1115 Otherwise the music snippet would be reset to the same content as the
1116 English version at next @command{make snippet-update} run -- see
1117 @ref{Updating documentation translation}.
1118
1119 When you encounter
1120
1121 @example
1122 @@lilypondfile[<number of fragment options>,texidoc]@{@var{filename.ly}@}
1123 @end example
1124
1125 @noindent
1126 in the source, open @file{input/lsr/@var{filename}.ly}, translate the
1127 @code{texidoc} header field it contains, enclose it with
1128 @code{texidoc@var{MY-LANGUAGE} = "} and @code{"}, and write it into
1129 @file{input/texidocs/@var{filename}.texidoc} -- please keep possibly
1130 existing translations in other languages!  Additionnally, you may
1131 translate the snippet's title in @code{doctitle} header field, in case
1132 @code{doctitle} is a fragment option used in @code{@@lilypondfile};
1133 you can do this exactly the same way as @code{texidoc}.  For instance,
1134 @file{input/texidocs/@var{filename}.texidoc} may contain
1135
1136 @example
1137 doctitlees = "Spanish title baz"
1138 texidoces = "
1139 Spanish translation blah
1140 "
1141 doctitlede = "German title bar"
1142 texidocde = "German translation foo
1143 "
1144 @end example
1145
1146 @code{@@example} blocs need not be verbatim copies, e.g. variable
1147 names, file names and comments should be translated.
1148
1149 Index entries (@code{@@cindex} and so on) should be translated.
1150
1151 Finally, please carefully apply every rule exposed in @ref{Texinfo
1152 introduction and usage policy}, and @ref{Documentation policy}.  If
1153 one of these rules conflicts with a rule specific to your language,
1154 please ask the Translation meister and/or the Documentation Editors on
1155 @email{lilypond-devel@@gnu.org}.
1156
1157
1158 @node Translating the Notation Reference and Application Usage
1159 @unnumberedsubsubsec Translating the Notation Reference and Application Usage
1160
1161 Copy @file{user/lilypond.tely} (or @file{user/lilypond-program.tely},
1162 respectively) into @file{@var{MY-LANGUAGE}/user}, then translate this
1163 file and run @code{skeleton-update} -- see @ref{Updating documentation
1164 translation}.  Your are now ready to translate the Notation Reference
1165 (Application Usage, respectively) exactly like the Learning Manual.
1166
1167
1168 @node Translating the Documentation index index.html.in
1169 @unnumberedsubsubsec Translating the Documentation index @file{index.html.in}
1170
1171 Unlike almost all HTML pages in this documentation, links in this page
1172 are not tweaked by @file{postprocess_html.py}, so links should be
1173 manually edited to link to existing translations.
1174
1175
1176 @node Documentation translation maintenance
1177 @subsection Documentation translation maintenance
1178
1179 Several tools have been developed to make translations maintenance
1180 easier.  These helper scripts make use of the power of Git, the
1181 version control system used for LilyPond development.
1182
1183 @menu
1184 * Check state of translation::  
1185 * Updating documentation translation::  
1186 @end menu
1187
1188 @node Check state of translation
1189 @unnumberedsubsubsec Check state of translation
1190
1191 First pull from Git, then cd into @file{Documentation/} (or at top of
1192 the source tree, replace @command{make} with @command{make -C
1193 Documentation}) and run
1194
1195 @example
1196 make ISOLANG=@var{MY_LANGUAGE} check-translation
1197 @end example
1198
1199 @noindent
1200 This presents a diff of the original files since the most recent
1201 revision of the translation.  To check a single file, cd into
1202 @file{Documentation/} and run
1203
1204 @example
1205 make CHECKED_FILES=@var{MY_LANGUAGE/user/foo.itely} check-translation
1206 @end example
1207
1208 To see only which files need to be updated, do
1209
1210 @example
1211 make ISOLANG=@var{MY_LANGUAGE} check-translation | grep 'diff --git'
1212 @end example
1213
1214 To avoid printing terminal colors control characters, which is often
1215 desirable when you redirect output to a file, run
1216
1217 @example
1218 make ISOLANG=@var{MY_LANGUAGE} NO_COLOR=1 check-translation
1219 @end example
1220
1221 Global state of the translation is recorded in
1222 @file{Documentation/translations.html.in}, which is used to generate
1223 Translations status page.  To update that page, do from
1224 @file{Documentation/}
1225
1226 @example
1227 make translation-status
1228 @end example
1229
1230 This will also leave @file{out/translations-status.txt}, which contains
1231 up-to-dateness percentages for each translated file, and update word
1232 counts of documentation files in this Guide.
1233
1234 @seealso
1235
1236 @ref{Maintaining without updating translations}.
1237
1238
1239 @node Updating documentation translation
1240 @unnumberedsubsubsec Updating documentation translation
1241
1242 Instead of running @code{check-translation}, you may want to run
1243 @code{update-translation}, which will run your favorite text editor to
1244 update files.  First, make sure environment variable @code{EDITOR} is
1245 set to a text editor command, then run from @file{Documentation/}
1246
1247 @example
1248 make ISOLANG=@var{MY_LANGUAGE} update-translation
1249 @end example
1250
1251 or to update a single file
1252
1253 @example
1254 make CHECKED_FILES=@var{MY_LANGUAGE/user/foo.itely} update-translation
1255 @end example
1256
1257 For each file to be udpated, update-translation will open your text
1258 editor with this file and a diff of the file in English; if the diff
1259 cannot be generated or is bigger than the file in English itself, the
1260 full file in English will be opened instead.
1261
1262 Texinfo skeleton files, i.e. @file{.itely} files not yet translated,
1263 containing only the Texinfo structure can be updated automatically:
1264 whenever @command{make check-translation} shows that such files should
1265 be updated, run from @file{Documentation/}
1266
1267 @example
1268 make ISOLANG=@var{MY_LANGUAGE} skeleton-update
1269 @end example
1270
1271 @file{.po} message catalogs in @file{Documentation/po/} may be updated
1272 by issuing from @file{Documentation/} or @file{Documentation/po/}
1273
1274 @example
1275 make po-update
1276 @end example
1277
1278 @warning{if you run po-update and somebody else does the same and
1279 pushes before you push or send a patch to be applied, there will be a
1280 conflict when you pull.  Therefore, it is better that only the
1281 Translation meister runs this command.}
1282
1283 Updating music snippets can quickly become cumbersome, as most
1284 snippets should be identical in all languages.  Fortunately, there is
1285 a script that can do this odd job for you (run from
1286 @file{Documentation/}):
1287
1288 @example
1289 make ISOLANG=@var{MY_LANGUAGE} snippet-update
1290 @end example
1291
1292 This script overwrites music snippets in
1293 @file{@var{MY_LANGUAGE/user/every.itely}} with music snippets from
1294 @file{@var{user/every.itely}}.  It ignores skeleton files, and keeps
1295 intact music snippets preceded with a line starting with @code{@@c
1296 KEEP LY}; it reports an error for each @file{.itely} that has not the
1297 same music snippet count in both languages.  Always use this script
1298 with a lot of care, i.e. run it on a clean Git working tree, and check
1299 the changes it made with @command{git diff} before committing; if you
1300 don't do so, some @code{@@lilypond} snippets might be broken or make
1301 no sense in their context.
1302
1303 Finally, a command runs the three update processes above for all
1304 enabled languages (from @file{Documentation/}):
1305
1306 @example
1307 make all-translations-update
1308 @end example
1309
1310 Use this command with caution, and keep in mind it will not be really
1311 useful until translations are stabilized after the end of GDP.
1312
1313 @seealso
1314
1315 @ref{Maintaining without updating translations}.
1316
1317
1318 @node Translations management policies
1319 @subsection Translations management policies
1320
1321 These policies show the general intent of how the translations should
1322 be managed, they aim at helping translators, developers and
1323 coordinators work efficiently.
1324
1325 @menu
1326 * Maintaining without updating translations::  
1327 * Managing documentation translation with Git::  
1328 @end menu
1329
1330 @node Maintaining without updating translations
1331 @unnumberedsubsubsec Maintaining without updating translations
1332
1333 Keeping translations up to date under heavy changes in the
1334 documentation in English may be almost impossible, especially as
1335 during the former Grand Documentation Project (GDP) or the Grand
1336 Organization Project (GOP) when a lot of contributors brings changes.
1337 In addition, transloators may be (and that) involved in these porjects too.
1338
1339 it is possible -- and even recommended -- to
1340 perform some maintaining that keeps translated documentation usable
1341 and eases future translation updating.  The rationale below the tasks
1342 list motivates this plan.  The rationale below the tasks
1343 list motivates this plan.
1344
1345 The following tasks are listed in decreasing priority order.
1346
1347 @enumerate
1348 @item Update macros.itexi.
1349 For each obsolete macro definition, if it is possible to update macro
1350 usage in documentation with an automatic text or regexp substitution,
1351 do it and delete the macro definition from macros.itexi; otherwise,
1352 mark this macro definition as obsolete with a comment, and keep it in
1353 macros.itexi until the documentation translation has been updated and
1354 no longer uses this macro.
1355
1356 @item Update @file{*.tely} files completely with
1357 @command{make check-translation} -- you may want to redirect ouptput
1358 to a file because of overwhelming output, or call check-translation.py
1359 on individual files, see @ref{Check state of translation}.
1360
1361 @item In @file{.itelys}, match sections and .itely file names with those from
1362 English docs, which possibly involves moving nodes contents in block
1363 between files, without updating contents itself.  In other words, the
1364 game is catching where has gone each section.  In Learning manual, and
1365 in Notation Reference sections which have been revised in GDP, there
1366 may be completely new sections: in this case, copy @code{@@node} and
1367 @code{@@section}-command from English docs, and add the marker for
1368 untranslated status @code{@@untranslated} on a single line.  Note that
1369 it is not possible to exactly match subsections or subsubsections of
1370 documentation in English, when contents has been deeply revised; in
1371 this case, keep obsolete (sub)subsections in the translation, marking
1372 them with a line @code{@@c obsolete} just before the node.
1373
1374 Emacs with Texinfo mode makes this step easier:
1375
1376 @itemize
1377 @item without Emacs AucTeX installed, @key{C-c C-s} shows structure of current
1378 Texinfo file in a new buffer *Occur*; to show structure of two files
1379 simultaneously, first split Emacs window in 4 tiles (with @key{C-x 1}
1380 and @key{C-x 2}), press @key{C-c C-s} to show structure of one file
1381 (e.g. the translated file), copy *Occur* contents into *Scratch*, then
1382 press @key{C-c C-s} for the other file.
1383
1384 If you happen to have installed AucTeX, you can either call the macro
1385 by doing @key{M-x texinfo-show-structure} or create a key binding in your
1386 @file{~/.emacs}, by adding the four following lines:
1387
1388 @example
1389 (add-hook 'Texinfo-mode-hook
1390           '(lambda ()
1391              (define-key Texinfo-mode-map "\C-cs"
1392               'texinfo-show-structure)))
1393 @end example
1394
1395 @noindent
1396 and then obtain the structure in the *Occur* buffer with @key{C-c s}.
1397
1398 @item Do not bother updating @code{@@menu}s when all menu entries are in the same
1399 file, just do @key{C-c C-u C-a} ("update all menus") when you have
1400 updated all the rest of the file.
1401
1402 @item Moving to next or previous node using incremental search: press
1403 @key{C-s} and type @code{node} (or @key{C-s @@node} if the text
1404 contains the word @q{node}) then press @key{C-s} to move to next node
1405 or @key{C-r} to move to previous node.  Similar operation can be used
1406 to move to the next/previous section.  Note that every cursor move
1407 exits incremental search, and hitting @key{C-s} twice starts
1408 incremental search with the text entered in previous incremental
1409 search.
1410
1411 @item Moving a whole node (or even a sequence of nodes): jump to beginning
1412 of the node (quit incremental search by pressing an arrow), press
1413 @key{C-SPACE}, press @key{C-s node} and repeat @key{C-s} until you
1414 have selected enough text, cut it with @key{C-w} or @key{C-x}, jump to
1415 the right place (moving between nodes with the previous hint is often
1416 useful) and paste with @key{C-y} or @key{C-v}.
1417 @end itemize
1418
1419 @item Update sections finished in the English documentation; check
1420 sections status at
1421 @uref{http://lilypondwiki.tuxfamily.org/index.php?title=Documentation_coordination}.
1422
1423 @item Update documentation PO.  It is recommended not to update
1424 strings which come from documentation that is currently deeply revised
1425 in English, to avoid doing the work more than once.
1426
1427 @item Fix broken cross-references by running (from @file{Documentation/})
1428
1429 @example
1430 make ISOLANG=@var{YOUR-LANGUAGE} fix-xrefs
1431 @end example
1432
1433 @noindent
1434 This step requires a sucessful documentation build (with @command{make
1435 web}).  Some cross-references are broken because they point to a node
1436 that exists in the documentation in English, which has not been added
1437 to the translation; in this case, do not fix the cross-reference but
1438 keep it "broken", so that the resulting HTML link will point to an
1439 existing page of documentation in English.
1440 @end enumerate
1441
1442 @subsubheading Rationale
1443
1444 You may wonder if it would not be better to leave translations as-is
1445 until you can really start updating translations.  There are several
1446 reasons to do these maintenance tasks right now.
1447
1448 @itemize
1449 @item This will have to be done sooner or later anyway, before updating
1450 translation of documentation contents, and this can already be done
1451 without needing to be redone later, as sections of documentation in
1452 English are mostly revised once.  However, note that not all
1453 documentation sectioning has been revised in one go, so all this
1454 maintenance plan has to be repeated whenever a big reorganization is
1455 made.
1456
1457 @item This just makes translated documentation take advantage of the new
1458 organization, which is better than the old one.
1459
1460 @item Moving and renaming sections to match sectioning of documentation in
1461 English simplify future updating work: it allows updating the
1462 translation by side-by-side comparison, without bothering whether
1463 cross-reference names already exist in the translation.
1464
1465 @item Each maintenance task except @q{Updating PO files} can be done by
1466 the same person for all languages, which saves overall time spent by
1467 translators to achieve this task: the node names and section titles
1468 are in English, so you can do.  It is important to take advantage of
1469 this now, as it will be more complicated (but still possible) to do
1470 step 3 in all languages when documentation is compiled with
1471 @command{texi2html} and node names are directly translated in source
1472 files.
1473 @end itemize
1474
1475
1476 @node Managing documentation translation with Git
1477 @unnumberedsubsubsec Managing documentation translation with Git
1478
1479 This policy explains how to manage Git branches and commit
1480 translations to Git.
1481
1482 @itemize
1483 @item Translation changes matching master branch are preferably made on
1484 @code{lilypond/translation} branch; they may be pushed directly to
1485 @code{master} only if they do not break compilation of LilyPond and
1486 its documentation, and in this case they should be pushed to
1487 @code{lilypond/translation} too.  Similarly, changes matching
1488 @code{stable/X.Y} are preferably made on
1489 @code{lilypond/X.Ytranslation}.
1490
1491 @item @code{lilypond/translation} Git branch may be merged into master only if
1492 LilyPond (@command{make all}) and documentation (@command{make web}) compile
1493 succesfully.
1494
1495 @item @code{master} Git branch may be merged into
1496 @code{lilypond/translation} whenever @command{make} and @command{make
1497 web} are succesful (in order to ease documentation compilation by
1498 translators), or when significant changes had been made in
1499 documentation in English in master branch.
1500
1501 @item General maintenance may be done by anybody who knows what he does
1502 in documentation in all languages, without informing translators
1503 first.  General maintenance include simple text substitutions
1504 (e.g. automated by sed), compilation fixes, updating Texinfo or
1505 lilypond-book commands, updating macros, updating ly code, fixing
1506 cross-references, and operations described in @ref{Maintaining
1507 without updating translations}.
1508 @end itemize
1509
1510
1511 @node Technical background
1512 @subsection Technical background
1513
1514 A number of Python scripts handle a part of the documentation
1515 translation process.  All scripts used to maintain the translations
1516 are located in @file{scripts/auxiliar/}.
1517
1518 @itemize
1519 @item @file{check_translation.py}  -- show diff to update a translation,
1520 @item @file{texi-langutils.py}  -- quickly and dirtily parse Texinfo files to
1521 make message catalogs and Texinfo skeleton files,
1522 @item @file{texi-skeleton-update.py} -- update Texinfo skeleton files,
1523 @item @file{update-snippets.py} -- synchronize ly snippets with those
1524 from English docs,
1525 @item @file{translations-status.py} -- update translations status pages and word
1526 counts in the file you are reading,
1527 @item @file{tely-gettext.py} -- gettext node names, section titles and references
1528 in the sources; WARNING only use this script once for each file, when support for
1529 "makeinfo --html" has been dropped.
1530 @end itemize
1531
1532 Other scripts are used in the build process, in @file{scripts/build/}:
1533
1534 @itemize
1535 @item @file{html-gettext.py} -- translate node names, section titles and cross
1536 references in HTML files generated by @command{makeinfo},
1537 @item @file{texi-gettext.py} -- gettext node names, section titles and references
1538 before calling @command{texi2pdf},
1539 @item @file{mass-link.py} -- link or symlink files between English documentation
1540 and documentation in other languages.
1541 @end itemize
1542
1543 Python modules used by scripts in @file{scripts/auxiliar/} or @file{scripts/build/} (but
1544 not by installed Python scripts) are located in @file{python/auxiliar/}:
1545 @itemize
1546 @item @file{manuals_definitions.py} -- define manual names and name of
1547 cross-reference Texinfo macros,
1548 @item @file{buildlib.py} -- common functions (read piped output
1549 of a shell command, use Git),
1550 @item @file{postprocess_html.py} (module imported by @file{www_post.py}) -- add footer and
1551 tweak links in HTML pages.
1552 @end itemize
1553
1554 And finally
1555 @itemize
1556 @item @file{python/langdefs.py}  -- language definitions module
1557 @end itemize