Change short-indent behaviour.
[lilypond.git] / Documentation / TRANSLATION
blob7ad31416f530df338aa0f45c850be0d33741028e
1 LILYPOND DOCUMENTATION TRANSLATION
3 TABLE OF CONTENTS
5 SOURCES
6 GIT
7 REQUIREMENTS
8 WHICH DOCUMENTATION CAN BE TRANSLATED
9 STARTING A TRANSLATION IN A NEW LANGUAGE
10 FILES TO BE TRANSLATED
11 TRANSLATION DETAILED INSTRUCTIONS
12 * LEARNING MANUAL AND OTHER TEXINFO DOCUMENTATION
13 * REFERENCE NOTATION AND PROGRAM USAGE MANUAL
14 * DOCUMENTATION INDEX index.html.in
15 CHECK STATE OF TRANSLATION
16 UPDATE A TRANSLATION
17 POLICY DURING GDP PROCESS
18 MANAGING TRANSLATIONS WITH GIT
19 SOME GIT TIPS
20 DEALING WITH SEVERAL GIT BRANCHES
21 GIT PUSH ACCESS
22 TECHNICAL BACKGROUND
25 SOURCES
27 The sources live in a GIT repository.  Git 1.5.x is required, and
28 latest version available on your platform is always recommended.  To
29 get a fresh version of LilyPond sources run
31     mkdir lily ; cd lily ; git init-db ; mkdir .git/remotes
33 then write the two following lines to a text file named .git/remotes/trans
35 URL: git://git.sv.gnu.org/lilypond.git/
36 Pull: lilypond/translation:refs/remotes/origin/lilypond/translation
38 then run
40     git fetch trans
41     git checkout -b lilypond/translation origin/lilypond/translation
44 GIT
46 The reader is supposed to be familiar with Git, for example by
47 having experience from lilypond.org translation; see
48 http://git.sv.gnu.org/gitweb/?p=lilypond.git;a=blob_plain;f=README;hb=web/master
51 REQUIREMENTS
53 Working on LilyPond documentation translations requires:
55     * python
56     * make
57     * gettext
60 WHICH DOCUMENTATION CAN BE TRANSLATED
62 The makfiles and scripts infrastructure currently supports translation
63 of the following documentation:
65     * documentation index (HTML)
66     * user manual and program usage -- Texinfo source, PDF and HTML
67 output; Info output might be added if there is enough demand for it.
70 STARTING A TRANSLATION IN A NEW LANGUAGE
72 At top of the source directory, do
74     ./autogen.sh
76 or (if you want to install your self-compiled LilyPond locally):
78     ./autogen.sh --prefix=$HOME
80 If you want to compile LilyPond -- which is almost required to build
81 the docs, but is not required to do translation only -- fix all
82 dependencies and rerun ./configure (with the same options as for
83 autogen).
85 Cd into Documentation and run:
87     make ISOLANG=<MY-LANGUAGE> new-lang
89 where <MY-LANGUAGE> is the ISO 639 language code.
91 Add a language definition for your language in
92 buildscripts/langdefs.py.
94 See next section about what files to translate and the following
95 detailed instructions after the next section.
98 FILES TO BE TRANSLATED
100 All the following files are in Documentation/
101 Translation of Documentation/foo/bar should be
102 Documentation/<LANG>/foo/bar.
103 Unmentioned files should not be translated.
105 Priorities:
106   1. delivery
107   2. 3. 4. 5. later
108   6. optional
110 Files marked with priority 3, 4 or 5 may be submitted individually.
111 Word counts (excluding lilypond snippets) are given for each file.
113 -1- Documentation index and Tutorial
114 412   user/lilypond-learning.tely
115 5652  user/tutorial.itely
116 23    user/dedication.itely
117 378   user/macros.itexi
118 218   index.html.in
119 3457  po/lilypond-doc.pot (translate to po/<MY_LANGUAGE>.po)
120 10140 total
122 -2- Introduction and beginning of Application Usage
123 411   user/preface.itely
124 3699  user/introduction.itely
125 390   user/lilypond-program.tely
126 1681  user/install.itely (partial translation)
127 1012  user/setup.itely
128 2879  user/running.itely
129 10072 total
131 -3- Learning manual
132 9800  user/fundamental.itely -- Fundamental concepts
133 12262 user/tweaks.itely -- Tweaking output
134 3005  user/working.itely -- Working on LilyPond files
135 483   user/templates.itely -- Templates
136 25550 total
138 -4- Notation reference
139 544   user/lilypond.tely
140 91    user/notation.itely -- Musical notation
141 2822  user/pitches.itely
142 6657  user/rhythms.itely
143 843   user/expressive.itely
144 940   user/repeats.itely
145 883   user/simultaneous.itely
146 2310  user/staff.itely
147 827   user/editorial.itely
148 1851  user/text.itely
149 73    user/specialist.itely -- Specialist notation
150 2745  user/vocal.itely
151 1303  user/chords.itely
152 702   user/piano.itely
153 546   user/percussion.itely
154 826   user/guitar.itely
155 66    user/strings.itely
156 242   user/bagpipes.itely
157 3474  user/ancient.itely
158 5399  user/input.itely -- Input syntax
159 2164  user/non-music.itely -- Non-musical notation
160 8400  user/spacing.itely -- Spacing issues
161 6855  user/changing-defaults.itely -- Changing defaults
162 5213  user/programming-interface.itely -- Interfaces for programmers
163 1127  user/notation-appendices.itely -- Notation manual tables
164 250   user/cheatsheet.itely -- Cheat sheet
165 57153 total
167 -5- Application usage
168 3175  user/lilypond-book.itely -- LilyPond-book
169 995   user/converters.itely -- Converting from other formats
170 4170  total
172 -6- Appendices whose translation is optional
173 299   user/literature.itely
174 960   user/scheme-tutorial.itely (needs to be revised first)
175 1259  total
178 TRANSLATION DETAILED INSTRUCTIONS
180 Please follow all these instructions with care to ensure quality work.
182 All files should be encoded in UTF-8.
184 * LEARNING MANUAL AND OTHER TEXINFO DOCUMENTATION
186 Any title which comes with one of the following commands must not be
187 translated directly in the Texinfo source
189 @node                                                   @majorheading
190 @chapter       @unnumbered          @appendix           @chapheading
191 @section       @unnumberedsec       @appendixsec        @heading
192 @subsection    @unnumberedsubsec    @appendixsubsec     @subheading
193 @subsubsection @unnumberedsubsubsec @appendixsubsubsec  @subsubheading
194 @ref           @rglos
196 As a notable exception, the second argument 'Bar baz' of
197 @ref{Foo,'Bar baz',,info-file} should be translated.
199 @uref's names are to be translated.
201 In any section which looks like
203 @menu
204 * node1:: thing1
205 * node2:: thing2
207 @end menu
209 the node names (nodeN) are NOT to be translated, whereas extra title
210 information (thingN) is.
212 Every node name or section title must from now on be translated
213 separately in a .po file (just as well as LilyPond output messages).
214 This .po file should be in Documentation/po.
217 Take care of using typographic rules for your language, especially in
218 user/macros.itexi.
221 Please keep verbatim copies of music snippets (in @lilypond blocs).
222 However, some music snippets containing text that shows in the
223 rendered music, and sometimes translating this text really helps the
224 user to understand the documentation; in this case, and only in this
225 case, you may as an exception translate text in the music snippet, and
226 then you must add a line immediately before the @lilypond block,
227 beginning with
229 @c KEEP LY
231 Otherwise the music snippet would be reset to the same content as the
232 English version at next 'make snippet-update' run (see UPDATING A
233 TRANSLATION below).
235 When you encounter
237   @lilypondfile[<number of fragment options>,texidoc]{FILENAME.ly}
239 in the source, open input/lsr/FILENAME.ly, translate the `texidoc'
240 header field it contains, enclose it with 'texidoc<MY-LANGUAGE> = "'
241 and '"', and write it into input/texidocs/FILENAME.texidoc -- please
242 keep possibly existing translations in other languages!
243 Additionnally, you may translate the snippet's title in `doctitle'
244 header field, in case `doctitle' is a fragment option used in
245 @lilypondfile; you can do this exactly the same way as `texidoc'.  For
246 instance, input/texidocs/FILENAME.texidoc may contain
248 doctitlees = "Spanish title baz"
249 texidoces = "
250 Spanish translation blah
252 doctitlede = "German title bar"
253 texidocde = "German translation foo
257 @example blocs need not be verbatim copies, e.g. variable names,
258 file names and comments should be translated.
260 Index entries (@cindex and so on) should be translated.
262 Carefully apply every rule exposed in Documentation/README.txt.  If
263 one of these rules conflicts with a rule specific to your language,
264 please ask the Translation meister and/or the Documentation Editor on
265 lilypond-devel@gnu.org.
268 * REFERENCE NOTATION AND PROGRAM USAGE MANUAL
270 Copy user/lilypond.tely (or user/lilypond-program.tely, respectively)
271 into <MY-LANGUAGE>/user, then translate this file and run
272 skeleton-update (see UPDATE A TRANSLATION below).  Your are now ready
273 to translate notation reference (program usage manual, respectively)
274 exactly like the learning manual.
277 * DOCUMENTATION INDEX index.html.in
279 Unlike almost all HTML pages in this documentation, links in this page
280 are not tweaked by add_html_footer.py, so links should be manually
281 edited to link to existing translations.
284 CHECK STATE OF TRANSLATION
286 First pull, then cd into Documentation (or at top of the source tree,
287 replace 'make' with 'make -C Documentation') and run
289     make ISOLANG=<MY_LANGUAGE> check-translation
291 This presents a diff of the original files since the most recent
292 revision of the translation.  To check a single file, cd into
293 Documentation and run
295     make CHECKED_FILES=<MY-LANGUAGE>/user/foo.itely check-translation
298 Small tip: to see only which files need to be updated, do
300     make ISOLANG=<MY_LANGUAGE> check-translation | grep 'diff --git'
303 Global state of the translation is recorded in
304 Documentation/translations.html.in, which is used to generate
305 Translations status page.  To update that page, do from Documentation/
307     make translation-status
309 This will also leave out/translations-status.txt, which contains
310 up-to-dateness percentages for each translated file, and update word
311 counts of documentation files in this file.
314 UPDATE A TRANSLATION
316 Instead of running check-translation, you can run update-translation,
317 which will run your favorite text editor to update files.  First, make
318 sure environment variable EDITOR is set to a text editor command, then
319 run from Documentation
321     make ISOLANG=<MY-LANGUAGE> update-translation
323 or to update a single file
325     make CHECKED_FILES=<MY-LANGUAGE>/user/foo.itely update-translation
327 For each file to be udpated, update-translation will open your text
328 editor with this file and a diff of the file in English; if the diff
329 cannot be generated or is bigger than the file in English itself, the
330 full file in English will be opened instead.
332 Texinfo skeleton files, i.e. .itely files not yet translated,
333 containing only the Texinfo structure can be updated automatically:
334 whenever 'make check-translation' shows that such files should be
335 updated, run from Documentation
337     make ISOLANG=<MY_LANGUAGE> skeleton-update
339 .po message catalogs in Documentation/po may be updated with (from
340 Documentation or Documentation/po)
342     make po-update
344 WARNING: if you run po-update and somebody else does the same and
345 pushes before you push or send a patch to be applied, there will be a
346 conflict when you pull.  Therefore, it is better that only the
347 Translation meister runs this command.
349 Updating music snippets can quickly become cumbersome, as most
350 snippets should be identical in all languages.  Fortunately, there is
351 a script that can do this odd job for you (run from Documentation):
353     make ISOLANG=<MY_LANGUAGE> snippet-update
355 This script overwrites music snippets in <MY_LANGUAGE>/user/every.itely
356 with music snippets from user/every.itely.  It ignores skeleton files,
357 and keeps intact music snippets preceded with a line starting with '@c
358 KEEP LY'; it reports an error for each .itely that has not the same
359 music snippet count in both languages.
361 Finally, a command runs the three update processes above for all
362 enabled languages (from Documentation):
364     make all-translations-update
366 Use this command with caution, and keep in mind it will not be really
367 useful until translations are stabilized after the end of GDP.
370 POLICY DURING GDP PROCESS
371 or "How to maintain translations without updating them"
373 During GDP progress, documentation changes so much, and translators are
374 often involved in GDP too, so keeping translations up to date is very
375 difficult.  However, it is possible -- and even recommended -- to
376 perform some maintaining that keeps translated documentation usable
377 and eases future translation updating.  The rationale below the tasks
378 list motivates this plan.
380 The following tasks are listed in decreasing priority order.
382 1) Update macros.itexi.  For each obsolete macro definition, if it is
383 possible to update macro usage in documentation with an automatic text
384 or regexp substitution, do it and delete the macro definition from
385 macros.itexi; otherwise, mark this macro definition as obsolete with a
386 comment, and keep it in macros.itexi until the documentation
387 translation has been updated and no longer uses this macro.
389 2) Update *.tely files completely with make check-translation -- you
390 may want to redirect ouptput to a file because of overwhelming output,
391 or call check-translation.py on individual files, see CHECK STATE OF
392 TRANSLATION.
394 3) in .itelys, match sections and .itely file names with those from
395 English docs, which possibly involves moving nodes contents in block
396 between files, without updating contents itself.  In other words, the
397 game is catching where has gone each section.  In Learning manual, and
398 in Notation Reference sections which have been revised in GDP, there
399 may be completely new sections: in this case, copy @node and
400 @section-command from English docs, and put the usual tricky line
401 'UNTRANSLATED NODE: IGNORE ME'.  Note that it is not possible to
402 exactly match subsections or subsubsections of documentation in
403 English, when contents has been deeply revised; in this case, kee
404 obsolete (sub)subsections in the translation.
406 * Hints for Emacs users (without Emacs AucTeX installed)
408 Emacs with Texinfo mode makes this step easier:
410 - without Emacs AucTeX installed, C-c C-s shows structure of current
411 Texinfo file in a new buffer *Occur*; to show structure of two files 
412 simultaneously, first split Emacs window in 4 tiles (with C-x 1 and 
413 C-x 2), press C-c C-s to show structure of one file (e.g. the translated
414 file), copy *Occur* contents into *Scratch*, then press C-c C-s for the 
415 other file.
416 If you happen to have installed AucTeX, you can either call the macro
417 by doing M-x texinfo-show-structure or create a key binding in your
418 ~/.emacs, by adding the four following lines:
419         (add-hook 'Texinfo-mode-hook
420                   '(lambda ()
421                      (define-key Texinfo-mode-map "\C-cs"
422                       'texinfo-show-structure)))
423 and then obtain the structure in the *Occur* buffer with C-c s
426 - Do not bother updating @menus when all menu entries are in the same
427 file ; make sure there is at least a (possibly empty) @menu block
428 everywhere it is needed, then do C-c C-u C-a ("update all menus") when
429 you have updated all the rest of the file.
431 - Moving to next or previous node: press C-s and type node (or C-s
432 @node if the text contains the word 'node') then press C-s to move to
433 next node or C-r to move to previous node.  Similar operation can be
434 used to move to the next/previous section.
436 - Moving a whole node (or even a sequence of nodes): jump to beginning
437 of the node (quit incremental search by pressing an arrow), press
438 C-SPACE, press C-s node and repeat C-s until you have selected enough
439 text, cut it with C-w or C-x, jump to the right place (moving between
440 nodes with the previous hint is often useful) and paste with C-y or
441 C-v.
444 4) update documentation PO.  Unless you have special interest in
445 having all titles translated in the next development release, it is
446 better to wait until step 3) has been completed, to avoid doing the
447 work more than once.
449 5) Fix broken cross-references by running (from Documentation/)
451   make ISOLANG=<YOUR-LANGUAGE> fix-xrefs
453 This step requires a sucessful documentation build (with 'make web').
454 Some cross-references are broken because they point to a node that
455 exists in the documentation in English, which has not been added to
456 the translation; in this case, do not fix the cross-reference but keep
457 it "broken", so that the resulting HTML link will point to an existing
458 page of documentation in English.
460 Rationale
462 You may wonder if it would not be better to leave translations as-is
463 until you can really start updating translations.  There are several
464 reasons to do these maintenance tasks right now.
466 - This will have to be done sooner or later anyway, before updating
467 translation of documentation contents, and this can already be done
468 without needing to be redone later, as sections of documentation in
469 English are mostly revised once.  However, note that not all
470 documentation sectioning has been revised in one go, so all this
471 maintenance plan has to be repeated whenever a big reorganization is
472 made. Currently (in May 2008), only chapters 3-7 in Notation Reference
473 and Application Usage have not been reorganized yet.
475 - This just makes translated documentation take advantage of the new
476 organization, which is far better than the old one.
478 - Moving and renaming sections to match sectioning of documentation in
479 English simplify future updating work: it allows updating the
480 translation by side-by-side comparison, without bothering whether
481 cross-reference names already exist in the translation.
483 - Each maintenance task (except 4) updating PO files) can be done by
484 the same person for all languages, which saves overall time spent by
485 translators to achieve this task: the node names and section titles
486 are in English, so you can do.  It is important to take advantage of
487 this now, as it will be more complicated (but still possible) to do
488 step 3) in all languages when documentation is compiled with
489 texi2html and node names are directly translated in source files.
492 MANAGING TRANSLATIONS WITH GIT
494 This policy explains how to manage Git branches and commit
495 translations to Git.
497 * Translation changes matching master branch are preferably made on
498 lilypond/translation branch; they may be pushed directly on master
499 only if they do not break compilation of LilyPond and its
500 documentation, and in this case they should be pushed to
501 lilypond/translation too.  Similarly, changes matching stable/X.Y are
502 preferably made on lilypond/X.Ytranslation.
504 * lilypond/translation Git branch may be merged into master only if
505 LilyPond ('make all') and documentation ('make web') compile
506 succesfully.
508 * master Git branch may be merged into lilypond/translation whenever
509 'make' and 'make web' are succesful (in order to ease documentation
510 compilation by translators), or when significant changes had been made
511 in documentation in English in master branch.
513 * General maintenance may be done by anybody who knows what he does
514 in documentation in all languages, without informing translators
515 first.  General maintenance include simple text substitutions
516 (e.g. automated by sed), compilation fixes, updating Texinfo or
517 lilypond-book commands, updating macros, updating ly code, fixing
518 cross-references, and operations described in 'POLICY DURING GDP
519 PROCESS'.
522 SOME GIT TIPS
524 * Saving uncommited changes in the working tree:
526     git diff > foo.diff
528 This does not save untracked or ignored files.  If you prefer to
529 include changes added to the index with 'git add', replace 'git diff'
530 with 'git diff HEAD'.
531 Then, you may try to apply foo.diff on a source tree with
533     patch -p1 < foo.diff
536 DEALING WITH SEVERAL GIT BRANCHES
538 * It is possible to work with several branches on the same local Git
539 repository; this is especially useful for translators who may have to
540 deal with both lilypond/translation and a stable branch
541 (e.g. stable/2.12 or lilypond/translation-2.12).  To fetch and check
542 out a new branch named BRANCH on git.sv.gnu.org, write the two
543 following lines to a text file named .git/remotes/SHORTHAND --
544 SHORTHAND is the name of the remote file, i.e. whatever easy-to-type
545 name you would like to use when pulling or pushing BRANCH, and usually
546 SHORTHAND is an abbreviation of BRANCH without slashes
548 URL: git://git.sv.gnu.org/lilypond.git/
549 Pull: BRANCH:refs/remotes/origin/BRANCH
551 Then, run
553     git fetch SHORTHAND
554     git checkout -b BRANCH origin/BRANCH
556 After this, you are able to pull BRANCH from git.sv.gnu.org with
558     git pull SHORTHAND
560 You can check out another branch OTHER_BRANCH, i.e. check out
561 OTHER_BRANCH to the working tree, with
563     git checkout OTHER_BRANCH
565 E.g. lilypond/translation, which you still have in your local Git
566 repository but is no longer checked out since you have created the new
567 branch BRANCH.
569 Note that it is possible to check out another branch while having
570 uncommitted changes, but it is not recommended unless you know what
571 you are doing; it is recommended to run 'git status' to check this
572 kind of issue before checking out another branch.
574 When pulling using SHORTHAND, do not forget to check first that the
575 right branch is checked out, i.e. the branch named A in the first part
576 of the "A:B" refspec in .git/remotes/SHORTHAND: as a matter of fact,
577 when you pull using A:B refspec, Git fetch A on the server as B remote
578 branch on your local repository, then tries to merge B into the
579 currently checked out branch.
581 To remember which branch is currently checked out, run 'git branch',
582 which will list all branches and mark the currently checked out branch
583 with a star, or 'git status'.
586 * To merge branch FOO into branch BAR, i.e. to "add" all changes made
587 in branch FOO to branch BAR, run
589     git checkout BAR
590     git merge FOO
592 If any conflict happens, please carefully follow the instructions
593 given by 'git merge' -- you usually must resolve conflicts with a text
594 editor by merging pieces of files marked with "<<<" "===" and ">>>",
595 removing these 3 kinds of conflict marks, then commit the result
596 exactly like a usual commit.
598 For example, as a translator, you will often want to merge master into
599 lilypond/translation; on the other hand, the Translations meister
600 wants to merge lilypond/translation into master whenever he has
601 checked that lilypond/translation builds successfully.
604 * If you play with several Git branches (e.g. master,
605 lilypond/translation, stable/2.12), you may want to have one source
606 and build tree for each branch; this is possible with subdirectories
607 of your local Git repository, used as local cloned subrepositories.
608 To create a local clone for the branch named BRANCH, run
610     git checkout BRANCH
611     git clone -l -s -n . SUBDIR
612     cd SUBDIR
613     git reset --hard
615 Note that SUBDIR must be a directory name which does not already
616 exist.  In SUBDIR, you can use all Git commands to browse revisions
617 history, commit and uncommit changes; to update the cloned
618 subrepository with changes made on the main repository, cd into SUBDIR
619 and run 'git pull'; to send changes made on the subrepository back to
620 the main repository, run 'git push' from SUBDIR.  Note that only one
621 branch (the currently checked out branch) is created in the
622 subrepository by default; it is possible to have several branches in a
623 subrepository and do usual operations (checkout, merge, create,
624 delete...) on these branches, but this possibility is not detailed
625 here.
627 Note that when you push BRANCH from SUBDIR to the main repository,
628 and BRANCH is checked out in the main repository, you must save
629 uncommitted changes (see SOME GIT TIPS) and do 'git reset --hard' in
630 the main repository in order to apply pushed changes in the working
631 tree of the main repository.
634 GIT PUSH ACCESS
636 If you have permission to push to Git with login USER, please start a
637 new Git repository from scratch to avoid polluting history with
638 duplicate commits; follow the usual instructions, except that every
639 file you write in .git/remotes should contain instead
641 URL: ssh://USER@git.sv.gnu.org/srv/git/lilypond.git
642 Push: BRANCH:refs/heads/BRANCH
643 Pull: BRANCH:refs/remotes/origin/BRANCH
645 Then, you can use .git/remotes/NAME to push BRANCH with
647     git push NAME
649 which works regardless of the branch checked out.
652 TECHNICAL BACKGROUND
654 A number of Python scripts handle a part of the documentation
655 translation process.  All are located in buildscripts/, except
656 langdefs.py which is in python/
658 * buildlib.py -- module containing common functions (read piped output
659 of a shell command, use Git)
660 * langdefs.py  -- language definitions module
661 * check_translation.py  -- show diff to update a translation
662 * texi-langutils.py  -- quickly and dirtily parse Texinfo files to
663 make message catalogs and Texinfo skeleton files
664 * texi-skeleton-update.py -- update Texinfo skeleton files
665 * html-gettext.py -- translate node names, section titles and cross
666 references in HTML files generated by makeinfo
667 * add_html_footer.py (module imported by www_post.py) -- add footer and
668 tweak links in HTML pages
669 * texi-gettext.py -- gettext node names, section titles and references
670 before calling texi2pdf
671 * mass-link.py -- link or symlink files between English documentation
672 and documentation in other languages
673 * update-snippets.py -- synchronize ly snippets with those from
674 English docs
675 * translations-status.py -- update translations status pages and word
676 counts in the file you are reading.