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