1 \input texinfo @c -*-texinfo-*- vim:tw=72
2 @setfilename Localisation
3 @settitle Localisation - User messages in LilyPond
8 @chapter Localisation - User messages in LilyPond
12 This document provides some guidelines for uniformising user messages.
13 In the absence of other standards, we'll be using these rules when coding
14 for for LilyPond@footnote{
15 In addition to the C++ coding standards that come with Lily
16 }. Hopefully, this can be replaced by general GNU
17 guidelines in the future.
19 Not-preferred messages are marked with @code{+}.
20 By convention, agrammatical examples are marked with @code{*}.
28 Every message to the user should be localised (and thus be marked
29 for localisation). This includes warning and error messages.
32 Don't localise/gettextify:
35 @item @code{programming_error ()}s
36 @item @code{programming_warning ()}s
38 @item output strings (PostScript, TeX)@footnote{
39 This may seem ridiculously obvious, however, makeinfo-3.12s localises
40 output strings. Sending bug report now ---jcn
47 Messages to be localised must be encapsulated in @code{_ (STRING)}
48 or @code{_f (FORMAT, ...)}. Eg:
51 warning (_ ("Need music in a score"));
52 error (_f ("Can't open file: `%s'", file_name));
55 In some rare cases you may need to call @code{gettext ()} by hand.
56 This happens when you pre-define (a list of) string constants for later
57 use. In that case, you'll probably also need to mark these string
58 constants for translation, using @code{_i (STRING)}. The @code{_i}
59 macro is a no-op, it only serves as a marker for @file{xgettext}.
62 char const* messages[] = @{
63 _i ("enable debugging output"),
64 _i ("ignore mudela version"),
71 puts (gettext (messages [i]));
76 @file{flower/getopt-long.cc} and @file{lily/main.cc}.
79 Don't use leading or trailing whitespace in messages.
82 Messages containing a final verb, or a gerund (@code{-ing}-form)
83 always start with a capital. Other (simpler) messages start with
87 The word `foo' is not declared.
93 To avoid having a number of different messages for the same situation,
94 we'll use quoting like this @code{"message: `%s'"} for all strings.
95 Numbers are not quoted:
98 _f ("Can't open file: `%s'", name_str)
99 _f ("Can't find charater number: %d", i)
103 Think about translation issues.
104 In a lot of cases,it's better to translate a whole message.
105 The english grammar mustn't be imposed on the translator.
109 _ ("Stem at ") + moment.str () + _(" doen't fit in beam")
116 _f ("Stem at %s doen't fit in beam", moment.str ())
120 Split up multi-sentence messages, whenever possible. Instead of
123 warning (_f ("out of tune! Can't find: `%s', "Key_engraver"));
125 warning (_f ("Can't find font `%s', loading default",
133 warning (_ ("out of tune:");
134 warning (_f ("Can't find: `%s', "Key_engraver"));
136 warning (_f ("Can't find font: `%s', font_name));
137 warning (_f ("Loading default font"));
141 If you must have multiple-sentence messages, use full punctuation.
142 Use two spaces after end of sentence punctuation.
143 No punctuation (esp. period) is used at the end of simple messages.
146 _f ("Non-matching braces in text `%s', adding braces", text)
147 _ ("Debug output disabled. Compiled with NPRINT.")
148 _f ("Huh? Not a Request: `%s'. Ignoring.", request)
152 Don't modularise too much; a lot of words cannot be translated
154 It's probably safe to treat most occurences of words like
155 stem, beam, crescendo as separately translatable words.
158 When translating, it is preferrable to put interesting information
159 at the end of the message, rather than embedded in the middle.
160 This especially applies to frequently used messages, even if this
161 would mean sacrificing a bit of eloquency. This holds for original
162 messages too, of course.
165 en: can't open: `foo.ly'
166 + nl: kan `foo.ly' niet openen (1)
167 kan niet openen: `foo.ly'* (2)
168 niet te openen: `foo.ly'* (3)
171 The first nl message, although gramatically and stylishly correct,
172 is not friendly for parsing by humans (even if they speak dutch).
173 I guess we'd prefer something like (2) or (3).
176 Please don't run make po/po-update with GNU gettext < 0.10.35