]> git.lizzy.rs Git - rust.git/blob - src/doc/README.md
be0938022d2cc28f22346332dcd9e15673334fc1
[rust.git] / src / doc / README.md
1 # Dependencies
2
3 [Pandoc](http://johnmacfarlane.net/pandoc/installing.html), a universal
4 document converter, is required to generate docs as HTML from Rust's
5 source code.
6
7 [po4a](http://po4a.alioth.debian.org/) is required for generating translated
8 docs from the master (English) docs.
9
10 [GNU gettext](http://www.gnu.org/software/gettext/) is required for managing
11 the translation data.
12
13 # Building
14
15 To generate all the docs, just run `make docs` from the root of the repository.
16 This will convert the distributed Markdown docs to HTML and generate HTML doc
17 for the 'std' and 'extra' libraries.
18
19 To generate HTML documentation from one source file/crate, do something like:
20
21 ~~~~
22 rustdoc --output-dir html-doc/ --output-format html ../src/libstd/path.rs
23 ~~~~
24
25 (This, of course, requires a working build of the `rustdoc` tool.)
26
27 # Additional notes
28
29 To generate an HTML version of a doc from Markdown manually, you can do
30 something like:
31
32 ~~~~
33 pandoc --from=markdown --to=html5 --number-sections -o rust.html rust.md
34 ~~~~
35
36 (rust.md being the Rust Reference Manual.)
37
38 The syntax for pandoc flavored markdown can be found at:
39 http://johnmacfarlane.net/pandoc/README.html#pandocs-markdown
40
41 A nice quick reference (for non-pandoc markdown) is at:
42 http://kramdown.rubyforge.org/quickref.html
43
44 # Notes for translators
45
46 Notice: The procedure described below is a work in progress. We are working on
47 translation system but the procedure contains some manual operations for now.
48
49 To start the translation for a new language, see po4a.conf at first.
50
51 To generate .pot and .po files, do something like:
52
53 ~~~~
54 po4a --copyright-holder="The Rust Project Developers" \
55     --package-name="Rust" \
56     --package-version="0.10-pre" \
57     -M UTF-8 -L UTF-8 \
58     src/doc/po4a.conf
59 ~~~~
60
61 (the version number must be changed if it is not 0.10-pre now.)
62
63 Now you can translate documents with .po files, commonly used with gettext. If
64 you are not familiar with gettext-based translation, please read the online
65 manual linked from http://www.gnu.org/software/gettext/ . We use UTF-8 as the
66 file encoding of .po files.
67
68 When you want to make a commit, do the command below before staging your
69 change:
70
71 ~~~~
72 for f in src/doc/po/**/*.po; do
73     msgattrib --translated $f -o $f.strip
74     if [ -e $f.strip ]; then
75        mv $f.strip $f
76     else
77        rm $f
78     fi
79 done
80 ~~~~
81
82 This removes untranslated entries from .po files to save disk space.