]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/user/development.itexi
907fbeb4ac6d6de2fae7814a0c65447cd9d5dda6
[lilypond.git] / Documentation / user / development.itexi
1 @node Internals
2 @chapter Internals
3
4 @menu
5 * Conversion stages::              Lilypond is a multi-pass program.
6
7 * Grobs::                          Graphical object  
8 * Engraver::
9 * Music_iterator::
10 * Music::
11 * Molecules::                       Molecules are stand-alone descriptions of output
12 @end menu
13
14 @node Conversion stages
15 @section Conversion stages
16
17 When translating the input to notation, there are number of distinct
18 phases.  We list them here:
19
20
21 @table @samp
22
23 @item Parsing:
24
25 The .ly file is read, and converted to a list of @code{Scores}, which
26 each contain @code{Music} and paper/midi-definitions.
27
28 @item Interpreting music
29
30 All music events are "read" in the same order as they would be played
31 (or read from paper). At every step of the interpretation, musical
32 events are delivered to
33 interpretation contexts,
34 @cindex engraver
35 which use them to build grobs (or MIDI objects, for MIDI output).
36
37 @item Prebreaking
38
39 At places where line breaks may occur, clefs and bars are prepared for
40 a possible line break. 
41
42 @item Preprocessing
43
44 In this stage, all information that is needed to determine line breaking
45 is computed. 
46
47 @item Break calculation:
48
49 The lines and horizontal positions of the columns are determined.
50
51 @item Breaking
52
53 Relations between all grobs are modified to reflect line breaks. See
54 also @ref{Pointer substitution}.
55
56 @item Outputting:
57
58 All vertical dimensions and spanning objects are computed, and all grobs
59 are output, line by line.
60
61 @end table
62
63
64 @node Grobs
65 @section Grobs
66
67 This section is about Grobs (short for Graphical Objects), which are
68 formatting objects used to create the final output. This material is
69 normally the domain of LilyPond gurus, but occasionally, a normal user
70 also has to deal with grobs.
71
72 The most simple interaction with Grobs are when you use
73 @code{\override}:
74
75 @example
76         \property Voice.Stem \override #'direction = #1
77 @end example
78
79 This piece of lily input causes all stem objects to be stem-up
80 henceforth.  In effect, you are telling lilypond to extend the defintion
81 of the "Stem" grob with the setting @code{direction := 1}.  Of course
82 there are many more ways of customizing Lily output, and since most of
83 them involve Grobs in some form, this section explains some details of
84 how grobs work.
85
86 @menu
87 * What is a grob?::
88 * Callbacks::
89 * Setting grob properties::
90 * Items and Spanners::
91 * Pointer substitution::
92 @end menu
93
94 @node What is a grob?
95 @subsection What is a grob?
96
97 In music notation, lots of symbols are related in some way.  You can
98 think of music notation as a graph where nodes are formed by the
99 symbols, and the arcs by their relations. A grob is node in that
100 graph. A grob stores references to other grobs, the directed edges in
101 the graph.
102
103 The objective of this big graph of grobs, is to specify the notation
104 problem. The solution of this problem is a description of the printout
105 that is in closed form, i.e. but a list of values.  These values are
106 Molecules. (see @ref{Molecules})
107
108 All grobs have an X and Y-position on the page.  These X and Y positions
109 are stored in a relative format, so they can easily be combined by
110 stacking them, hanging one grob to the side of another, and coupling
111 them into a grouping-grob.
112
113 Each grob has a reference point, or parent: the position of a grob is
114 stored relative to that reference point. For example the X-reference
115 point of a staccato dot usually is the note head that it applies
116 to. Whenever the note head is moved, the staccato dot moves along
117 automatically.
118
119 If you keep following offset reference points, you will always end up at
120 the root-object. This root object is called @code{Line_of_score}
121 @ref{(lilypond-internals)Element Line_of_score}, and it represents a
122 system (ie. a line of music).
123
124 All grobs carry a set of grob-properties.  In the Stem example above,
125 the property @code{direction} is set to value @code{1}.  The function
126 that draws the symbol (@code{Stem::brew_molecule}) uses the value of
127 @code{direction} to determine how to print the stem and the flag.  The
128 appearance of a grob is determined solely by the values of its
129 properties.
130
131 Often, a grob also is associated with a symbol. On the other hand,
132 Some grobs do not print any symbols, but take care of grouping
133 objects. For example, there is a separate grob that stacks staffs
134 vertically, so they are not printed in overstrike. The NoteCollision
135 @ref{(lilypond-internals)Element NoteCollision} is another example of
136 an abstract grob.  It only moves around chords, but doesn't print
137 anything.
138
139 A complete list of grob types is found in
140 @ref{(lilypond-internals)Elements}
141
142 Grobs are created in the "Interpreting music" phase, by things in
143 LilyPond called engravers.  In this phase of the translation, a load of
144 grobs are created, and they are linked into a giant network of objects.
145 This network of grobs forms the "specification" of the print
146 problem. This problem is then solved: configurations, directions,
147 dimensions, line breaks, etc.  are calculated. Finally,   the printing
148 description in the form of Molecules (@ref{Molecules})  is extracted from
149 the network. These are then dumped into the output file
150
151 @node Callbacks
152 @subsection Callbacks
153
154 Offsets of grobs are relative to a parent reference point. Most
155 positions are not known when an object is created, so these are
156 calculated as needed. This is done by adding a callback for a specific
157 direction.
158
159 Suppose you have the following code in a .ly file.
160 @example
161         #(define (my-callback gr axis)
162                 (*  2.0 (get-gr-property grob 'direction))
163         )
164
165 ....
166
167         \property Voice.Stem \override #'Y-offset-callbacks = #(list
168                         my-callback)
169 @end example
170
171 When the Y-offset of a Stem object is needed, LilyPond will
172 automatically execute all callbacks for that object. In this case, it
173 will find @code{my-callback}, and execute that. The result is that the
174 stem is translated by two staff spaces in its direction.
175
176 (note: Y-offset-callbacks is also a property) 
177
178
179 Offset callbacks can be stacked, ie.
180
181 @example
182         \property .... \override #'Y-offset-callbacks = #(list
183                 callback1 callback2 callback3)
184
185 @end example
186
187 The callbacks will be executed in the order callback3 callback2
188 callback1. This is used for quantized positioning: the staccato dot is
189 above or below a note head, and it must not be on a staff-line.
190
191 To achieve this, for the staccato there are two callbacks: one callback
192 that positions the grob above or below the note head, and one callback
193 that rounds the Y-position of the grob to the nearest open space.
194
195 Similarly, the size of a grob are determined through callbacks, settable
196 with grob properties @code{X-extent-callback} and @code{Y-extent-callback}.
197 There can be only one extent-callback for each axis. No callback (value #f)
198 means: "empty in this direction". If you fill in a pair, that pair
199 hard-codes the extent in that coordinate.
200
201
202 @node Setting grob properties
203 @subsection Setting grob properties
204
205 Grob properties are stored as GUILE association lists, with symbols as
206 keys.   From C++, element properties can be accessed using the functions
207
208 @example
209   SCM  get_grob_property (SCM) const;
210   void set_grob_property (const char * , SCM val);
211   void set_immutable_grob_property (const char * , SCM val);
212   void set_immutable_grob_property (SCM key, SCM val);  
213   void set_grob_property (SCM , SCM val);  
214   void set_grob_pointer (const char*, SCM val);
215   SCM  remove_grob_property (const char* nm);
216 @end example
217
218 In GUILE, LilyPond provides
219
220 @example
221         ly-get-grob-property GROB SYMBOL
222         ly-set-grob-property GROB SYMBOL VALUE
223 @end example
224
225 All lookup functions identify undefined properties with 
226 end-of-list (ie. @code{'()} in Scheme or @code{SCM_EOL} in C)
227
228 Properties are stored in two ways:
229 @itemize @bullet
230 @item mutable properties:
231 element properties that change from object to object. The storage of
232 these are private to a grob. Typically this is used to store lists of
233 pointers to other grobs
234
235 @item immutable properties:
236 element properties that are shared across different grobs of the same
237 type. The storage is shared, and hence it is read-only. Typically, this
238 is used to store function callbacks, and values for shared element
239 properties are read from @file{scm/element-description.scm}.
240 @end itemize
241
242 There are two ways to manually set grob properties.
243
244 You can change immutable grob properties. This is done with the
245 \override syntax:
246
247 @example
248         \property Voice.Stem \override #'direction = #1
249 @end example
250
251 This will push the entry @code{'(direction . 1)} on the immutable
252 property list for stems, in effect overriding the setting from
253 @file{scm/element-description.scm}. This can be undone by 
254
255 @example
256         \property Voice.stem \revert #'direction
257 @end example
258
259 If you use this a lot, this gets old quickly. So we also have a
260 shorthand,
261
262 @example
263         \property Context.GrobType \set #'prop = #VAL
264 @end example
265
266 this does a @code{\revert} followed by a @code{\override}
267
268 The second way is \outputproperty. This construct looks like
269
270 @example
271         \context ContextName \outputproperty @var{pred} #@var{sym} = #@var{val}
272 @end example
273
274 In this case, in every grob that satisfies @var{pred}, the property
275 assignment @var{sym} = @var{val} is done.  For example
276
277 @example
278         \outputproperty
279                 #(lambda (gr) (string? (ly-get-grob-property gr
280                         'text)))
281                 #'extra-offset = #'(-1.0 . 0.0)
282 @end example
283
284 This shifts all elements that have a @code{text} property one staff
285 space to the left. This mechanism is rather clumsy to use, but it allows
286 you tweak any setting of any grob.
287
288 @node Items and Spanners
289 @unnumberedsubsec Items and Spanners
290
291 Grobs can also be distinguished in their role in the horizontal spacing.
292 A lot of grobs define constraints on the spacing by their sizes. For
293 example, note heads, clefs, stems, and all other symbols with a fixed
294 shape.  These grobs form a subtype called @code{Item}.
295
296 Other grobs have a shape that depends on the horizontal spacing. For
297 example, slur, beam, tie, etc. These grobs form a subtype called
298 @code{Spanner}. All spanners have two span-points (these must be
299 @code{Item}s), one on the left and one on the right. The left bound is
300 also the X-reference point.
301
302 Some items need special treatment for line breaking. For example, a
303 clef is normally only printed at the start of a line (ie. after a line
304 break).  To model this, `breakable' items (clef, key signature, bar lines,
305 etc.) are copied twice. Then we have three versions of each breakable
306 item: one version if there is no line break, one version that is printed
307 before the line break (at the end of a system), one version that is
308 printed after the line break.
309
310 Whether these versions are visible and take up space, is determined by
311 the outcome of the visibility-lambda. This is a function taking a
312 direction (-1, 0 or 1) and returns a cons of booleans, signifying wether
313 this grob should be transparent and invisible.
314
315 @node Pointer substitution
316 @unnumberedsubsec Pointer substitution
317
318
319 Symbols that cross line-breaks (such as slurs) cause some more
320 complications. When a  spanner crosses a line-break, then the spanner is
321 "broken into pieces", for every line that the spanner is in, a copy of
322 the grob is made. A substitution process redirects all grob-reference
323 so that spanner grob will only reference other grobs in the same line.
324
325 @node Engraver
326 @section Engraver
327
328 @node Music_iterator
329 @section Music_iterator
330
331 @node Music
332 @section Music
333
334 @node Molecules
335 @section Molecules
336
337 The objective of any typesetting system is to put ink on paper in the
338 right places. For LilyPond, this final stage is left to the TeX and the
339 printer subsystem. For lily, the last stage in processing a score is
340 outputting a description of what to put where.  This description roughly
341 looks like
342
343 @example
344         PUT glyph AT (x,y)
345         PUT glyph AT (x,y)
346         PUT glyph AT (x,y) 
347 @end example
348
349 you merely have to look at the tex output of lily to see this.
350 Internally these instructions are encoded in Molecules:@footnote{At some
351 point LilyPond also contained Atom-objects, but they have been replaced
352 by Scheme expressions.}.  A molecule is an object that combines
353 dimension information (how large is this glyph ?) with
354 what-to-print-where.
355
356 Conceptually, Molecules can be constructed from Scheme code, by
357 translating a Molecule and by combining two molecules. In BNF notation:
358
359 @example
360  Molecule = COMBINE Molecule Molecule
361            | TRANSLATE Offset Molecule
362            | GLYPH-DESCRIPTION
363            ;
364 @end example
365
366 (refer to the C++ code for more details). All visible,
367 ie. non-transparent, grobs have a callback to create a Molecule. The
368 name of the property is @code{molecule-callback}, and its value should
369 be a Scheme function taking one argument (the grob) and returning a
370 Molecule.
371
372
373
374 @node Development
375 @chapter Development
376
377 @menu
378 * CodingStyle::
379 * Making patches::
380 * Localisation::
381 @end menu
382
383 @node CodingStyle
384 @section CodingStyle - standards while programming for GNU LilyPond
385
386 As a general rule, you should always try to continue computations, even
387 if there is some kind of error. When the program stops, it is often very
388 hard for a user to pinpoint what part of the input causes an
389 error. Finding the culprit is much easier if there is some viewable
390 output.
391
392 So functions and methods do not return errorcodes, they never crash, but
393 report a programming_error and try to carry on.
394
395 @unnumberedsubsec Languages
396
397 C++ and Python are preferred.  Python code should use an indent of 8,
398 using TAB characters.
399
400 @unnumberedsubsec Filenames
401
402 Definitions of classes that are only accessed via pointers
403 (*) or references (&) shall not be included as include files.
404
405 filenames
406
407 @example 
408         ".hh"   Include files
409         ".cc"   Implementation files
410         ".icc"  Inline definition files
411         ".tcc"  non inline Template defs
412 @end example 
413
414 in emacs:
415
416 @example 
417         (setq auto-mode-alist
418               (append '(("\\.make$" . makefile-mode)
419                         ("\\.cc$" . c++-mode)
420                         ("\\.icc$" . c++-mode)
421                         ("\\.tcc$" . c++-mode)
422                         ("\\.hh$" . c++-mode)
423                         ("\\.pod$" . text-mode)         
424                         )
425                       auto-mode-alist))
426 @end example 
427
428
429 The class Class_name is coded in @file{class-name.*}
430
431 @unnumberedsubsec Indentation
432
433 Standard GNU coding style is used.   In emacs:
434
435 @example 
436         (add-hook 'c++-mode-hook
437                   '(lambda() (c-set-style "gnu")
438                      )
439                   )
440 @end example 
441
442 If you like using font-lock, you can also add this to your @file{.emacs}:
443
444 @example 
445         (setq font-lock-maximum-decoration t)
446         (setq c++-font-lock-keywords-3 
447               (append
448                c++-font-lock-keywords-3
449                '(("\\b\\([a-zA-Z_]+_\\)\\b" 1 font-lock-variable-name-face)
450                ("\\b\\([A-Z]+[a-z_]+\\)\\b" 1 font-lock-type-face))
451                ))
452 @end example 
453
454 @unnumberedsubsec Classes and Types
455
456 @example 
457         This_is_a_class
458 @end example 
459
460 @unnumberedsubsec Members
461
462 @example 
463         Class::member ()
464         Type Class::member_type_
465         Type Class::member_type ()
466 @end example 
467
468 the @code{type} is a Hungarian notation postfix for @code{Type}. See below
469
470 @unnumberedsubsec Macros
471
472 Macro names should be written in uppercase completely.
473
474 @unnumberedsubsec Broken code
475
476 Try not to write broken code. This includes hardwired dependencies,
477 hardwired constants, slow algorithms and obvious limitations. If you can
478 not avoid it, mark the place clearly, and add a comment explaining
479 shortcomings of the code.
480
481 @unnumberedsec Hungarian notation naming convention
482
483 The C++ part of LilyPond uses a naming convention derived from the
484 so-called @emph{Hungarian Notation}.  Macros, @code{enum}s and
485 @code{const}s are all uppercase, with the parts of the names separated
486 by underscores.
487
488 The hungarian notation  is to be used when variables are not declared
489 near usage (mostly in member variables and functions).
490
491 @unnumberedsubsec Types
492
493 @table @samp
494 @item @code{byte}
495     unsigned char. (The postfix _by is ambiguous)
496 @item @code{b}
497     bool
498 @item @code{bi}
499     bit
500 @item @code{ch}
501     char
502 @item @code{f}
503     float
504 @item @code{i}
505     signed integer
506 @item @code{str}
507     string class
508 @item @code{sz}
509     Zero terminated c string
510 @item @code{u}
511     unsigned integer
512 @end table
513
514 @unnumberedsubsec User defined types
515
516 @example 
517
518         /*
519                 Slur blah. blah.
520         */
521         class Slur @{
522                 ...
523         @};
524         Slur* slur_p = new Slur;
525  
526 @end example 
527
528 @unnumberedsubsec Modifiers
529
530 The following types modify the meaning of the prefix. 
531 These are preceded by the prefixes:
532
533 @table @samp
534 @item @code{a}
535     array
536 @item @code{arr}
537     user built array.
538 @item @code{c}
539     const. Note that the proper order is @code{Type const}
540         and not @code{const Type}
541 @item @code{C}
542     A const pointer. This would be equivalent to @code{_c_l}, but since any
543     "const" pointer has to be a link (you can't delete a const pointer),
544     it is superfluous.
545 @item @code{l}
546     temporary pointer to object (link)
547 @item @code{p}
548     pointer to newed object
549 @item @code{r}
550     reference
551 @end table
552
553 @unnumberedsubsec Adjective
554
555 Adjectives such as global and static should be spelled out in full.
556 They come before the noun that they refer to, just as in normal english.
557
558 @example 
559
560 foo_global_i: a global variable of type int commonly called "foo".
561  
562 @end example 
563
564 static class members do not need the static_ prefix in the name (the
565 Class::var notation usually makes it clear that it is static)
566
567 @table @samp
568 @item @code{loop_i}
569     Variable loop: an integer
570 @item @code{u}
571     Temporary variable: an unsigned integer
572 @item @code{test_ch}
573     Variable test: a character
574 @item @code{first_name_str}
575     Variable first_name: a String class object
576 @item @code{last_name_ch_a}
577     Variable last_name: a @code{char} array
578 @item @code{foo_i_p}
579     Variable foo: an @code{Int*} that you must delete
580 @item @code{bar_i_l}
581     Variable bar: an @code{Int*} that you must not delete
582 @end table
583
584 Generally default arguments are taboo, except for nil pointers.
585
586 The naming convention can be quite conveniently memorised, by
587 expressing the type in english, and abbreviating it
588
589 @example 
590
591         static Array<int*> foo
592  
593 @end example 
594
595 @code{foo} can be described as "the static int-pointer user-array", so you get
596
597 @example 
598
599         foo_static_l_arr
600  
601 @end example 
602
603
604 @unnumberedsec Miscellaneous
605     
606 For some tasks, some scripts are supplied, notably creating patches, a
607 mirror of the website, generating the header to put over cc and hh
608 files, doing a release.
609
610 Use them.
611
612 @node Making patches
613 @section Making patches
614
615 @unnumberedsec  Track and distribute your code changes
616
617 This page documents how to distribute your changes to GNU lilypond
618     
619 We would like to have unified context diffs with full pathnames.  A
620 script automating supplied with Lily.
621
622 Distributing a change normally goes like this:
623
624 @itemize @bullet
625 @item make your fix/add your code 
626 @item Add changes to CHANGES, and add yourself to Documentation/topdocs/AUTHORS.texi
627 @item generate a patch, 
628 @item e-mail your patch to one of the mailing lists
629     gnu-music-discuss@@gnu.org or bug-gnu-music@@gnu.org
630 @end itemize
631
632 Please do not send entire files, even if the patch is bigger than the
633 original.  A patch makes it clear what is changed, and it won't
634 overwrite previous (not yet released) changes.
635
636 @unnumberedsec Generating a patch
637
638 Simple version: run
639
640 @example
641         make -C lilypond-x.y.z/ distclean
642         make -C lilypond-x.y.z.NEW/ distclean
643         diff -urN lilypond-x.y.z/ lilypond-x.y.z.NEW/
644 @end example
645
646 Complicated (but automated) version:
647
648 In @file{VERSION}, set MY_PATCH_LEVEL:
649
650 @example 
651
652     VERSION:
653         ...
654         MY_PATCH_LEVEL=jcn1
655  
656 @end example 
657
658 In @file{CHANGES}, enter a summary of changes:
659
660 @example 
661         0.1.73.jcn1
662         ===========
663
664         * A concise, yet clearly readable description of what changed.
665
666 @end example 
667
668 Then, from the top of Lily's source tree, type
669
670 @example 
671     make release
672 @end example 
673
674 These handy python scripts assume a directory structure which looks
675 like:
676
677 @example 
678
679     lilypond -> lilypond-x.y.z   # symlink to development directory
680     lilypond-x.y.z/              # current development
681     patches/                     # patches between different releases
682     releases/                    # .tar.gz releases
683
684 @end example 
685
686 @unnumberedsec Applying patches
687
688 [outdated: please use xdeltas]
689
690 If you're following LilyPond development regularly, you probably want to
691 download just the patch for each subsequent release.
692 After downloading the patch (into the patches directory, of course), simply 
693 apply it:
694
695 @example 
696
697     gzip -dc ../patches/lilypond-0.1.74.diff.gz | patch -p1 -E
698  
699 @end example 
700
701 and don't forget to make automatically generated files:
702
703 @example 
704
705     autoconf footnote(patches don't include automatically generated files, 
706     i.e. file(configure) and files generated by file(configure).)
707
708     configure
709  
710 @end example 
711
712 @node Localisation
713 @section Localisation - User messages in LilyPond
714
715 This document provides some guidelines for uniformising user messages.
716 In the absence of other standards, we'll be using these rules when coding
717  for LilyPond.  Hopefully, this can be replaced by general GNU
718 guidelines in the future.
719
720 Not-preferred messages are marked with @code{+}.  By convention,
721 agrammatical examples are marked with @code{*}.
722
723 @subsection Guidelines
724
725 @itemize @bullet
726
727 @item
728 Every message to the user should be localised (and thus be marked
729 for localisation).  This includes warning and error messages.
730
731 @item
732 Don't localise/gettextify:
733
734 @itemize @minus
735 @item @code{programming_error ()}s
736 @item @code{programming_warning ()}s
737 @item debug strings
738 @item output strings (PostScript, TeX)
739 @end itemize
740
741 @item
742 Messages to be localised must be encapsulated in @code{_ (STRING)}
743 or @code{_f (FORMAT, ...)}.  Eg:
744
745 @example
746 warning (_ ("Need music in a score"));
747 error (_f ("Can't open file: `%s'", file_name));
748 @end example
749
750 In some rare cases you may need to call @code{gettext ()} by hand.
751 This happens when you pre-define (a list of) string constants for later
752 use.  In that case, you'll probably also need to mark these string
753 constants for translation, using @code{_i (STRING)}.  The @code{_i}
754 macro is a no-op, it only serves as a marker for @file{xgettext}.
755
756 @example
757 char const* messages[] = @{
758   _i ("enable debugging output"),
759   _i ("ignore lilypond version"),
760   0
761 @};
762
763 void
764 foo (int i)
765 @{
766   puts (gettext (messages [i]));
767 @}
768 @end example
769
770 See also
771 @file{flower/getopt-long.cc} and @file{lily/main.cc}.
772
773 @item
774 Don't use leading or trailing whitespace in messages.
775
776 @item
777 Messages containing a final verb, or a gerund (@code{-ing}-form)
778 always start with a capital.  Other (simpler) messages start with
779 a lowercase letter:
780
781 @example
782 The word `foo' is not declared.
783 `foo': not declared.
784 Not declaring: `foo'.
785 @end example
786
787 @item
788 To avoid having a number of different messages for the same situation,
789 we'll use quoting like this @code{"message: `%s'"} for all strings.
790 Numbers are not quoted:
791
792 @example
793 _f ("Can't open file: `%s'", name_str)
794 _f ("Can't find charater number: %d", i)
795 @end example
796
797 @item
798 Think about translation issues.  In a lot of cases, it is better to
799 translate a whole message.  The english grammar mustn't be imposed on
800 the translator.  So, iso
801
802 @example
803 _ ("Stem at ") + moment.str () + _(" doen't fit in beam")
804 @end example
805
806 @noindent
807 have
808
809 @example
810 _f ("Stem at %s doen't fit in beam", moment.str ())
811 @end example
812
813 @item
814 Split up multi-sentence messages, whenever possible.  Instead of
815
816 @example
817 warning (_f ("out of tune!  Can't find: `%s', "Key_engraver"));
818
819 warning (_f ("Can't find font `%s', loading default", 
820              font_name));
821 @end example
822
823 @noindent
824 rather say:
825
826 @example
827 warning (_ ("out of tune:");
828 warning (_f ("Can't find: `%s', "Key_engraver"));
829
830 warning (_f ("Can't find font: `%s', font_name));
831 warning (_f ("Loading default font"));
832 @end example
833
834 @item
835 If you must have multiple-sentence messages, use full punctuation.
836 Use two spaces after end of sentence punctuation.
837 No punctuation (esp. period) is used at the end of simple messages.
838
839 @example
840    _f ("Non-matching braces in text `%s', adding braces", text)
841    _ ("Debug output disabled.  Compiled with NPRINT.")
842    _f ("Huh?  Not a Request: `%s'.  Ignoring.", request)
843 @end example
844
845 @item
846 Don't modularise too much; a lot of words cannot be translated
847 without context.
848 It's probably safe to treat most occurences of words like
849 stem, beam, crescendo as separately translatable words.
850
851 @item
852 When translating, it is preferrable to put interesting information 
853 at the end of the message, rather than embedded in the middle.
854 This especially applies to frequently used messages, even if this
855 would mean sacrificing a bit of eloquency.  This holds for original
856 messages too, of course.
857
858 @example
859     en: can't open: `foo.ly'
860 +   nl: kan `foo.ly' niet openen (1)
861     kan niet openen: `foo.ly'*   (2)
862     niet te openen: `foo.ly'*    (3)
863 @end example
864
865 The first nl message, although gramatically and stylishly correct,
866 is not friendly for parsing by humans (even if they speak dutch).
867 I guess we'd prefer something like (2) or (3).
868
869 @item
870 Please don't run make po/po-update with GNU gettext < 0.10.35
871
872 @end itemize