@@ -39,37 +39,38 @@ need the `msgmerge` and `msgcat` Gettext tool installed. Please see our
3939
4040First, you need to know how to update the ` .pot ` and ` .po ` files.
4141
42- You should never touch the auto-generated ` po/messages.pot ` file. You should
43- also not never the ` msgid ` entries in a ` po/xx.po ` file. If you find mistakes,
44- you need to update the original English text instead. The fixes to the English
45- text will flow into the ` .po ` files the next time the translators update them.
42+ You should never touch the auto-generated ` book/xgettext/messages.pot ` file. You
43+ should also not never the ` msgid ` entries in a ` po/xx.po ` file. If you find
44+ mistakes, you need to update the original English text instead. The fixes to the
45+ English text will flow into the ` .po ` files the next time the translators update
46+ them.
4647
4748> ** Tip:** See our [ style guide] ( STYLE.md ) for some things to keep in mind when
4849> writing the translation.
4950
5051### Generating the PO Template
5152
52- To extract the original English text and generate a ` messages.pot ` file, you run
53- ` mdbook ` with a special renderer:
53+ To extract the original English text and generate a ` messages.pot ` file, you
54+ build the book. This will automatically invoke the ` mdbook-xgettext ` renderer:
5455
5556``` shell
56- MDBOOK_OUTPUT=' {"xgettext": {"pot-file": "messages.pot", "granularity": 0}}' \
57- mdbook build -d po
57+ mdbook build
5858```
5959
60- You will find the generated POT file as ` po /messages.pot` .
60+ You will find the generated POT file as ` book/xgettext /messages.pot` .
6161
6262### Initialize a New Translation
6363
64- To start a new translation, first generate the ` po/messages.pot ` file. Then use
65- ` msginit ` to create a ` xx.po ` file for the fictional ` xx ` language:
64+ To start a new translation, first generate the ` book/xgettext/messages.pot `
65+ file. Then use ` msginit ` to create a ` xx.po ` file for the fictional ` xx `
66+ language:
6667
6768``` shell
68- msginit -i po /messages.pot -l xx -o po/xx.po
69+ msginit -i book/xgettext /messages.pot -l xx -o po/xx.po
6970```
7071
71- You can also simply copy ` po/ messages.pot` to ` po/xx.po ` . Then update the file
72- header (the first entry with ` msgid "" ` ) to the correct language.
72+ You can also simply copy ` book/xgettext/ messages.pot` to ` po/xx.po ` . Then update
73+ the file header (the first entry with ` msgid "" ` ) to the correct language.
7374
7475> ** Tip:** You can use the
7576> [ ` cloud-translate ` ] ( https://github.com/mgeisler/cloud-translate ) tool to
@@ -98,10 +99,10 @@ translations contain a POT-Creation-Date header which tells you when they were
9899last updated with new English messages.
99100
100101To update the ` po/xx.po ` file with new messages, first extract the English text
101- into a ` po /messages.pot` template file. Then run
102+ into a ` book/xgettext /messages.pot` template file. Then run
102103
103104``` shell
104- msgmerge --update po/xx.po po /messages.pot
105+ msgmerge --update po/xx.po book/xgettext /messages.pot
105106```
106107
107108Notice that the POT-Creation-Date field is updated to the current time and date.
@@ -162,9 +163,8 @@ To use the `po/xx.po` file for your output, run the following command:
162163MDBOOK_BOOK__LANGUAGE=xx mdbook build -d book/xx
163164```
164165
165- This will update the book's language to ` xx ` , it will make the ` mdbook-gettext `
166- preprocessor become active and tell it to use the ` po/xx.po ` file, and finally
167- it will redirect the output to ` book/xx ` .
166+ This will tell the ` mdbook-gettext ` preprocessor to translate the book using the
167+ ` po/xx.po ` file. The HTML output can be found in ` book/xx/html/ ` .
168168
169169### Serving a Translation
170170
0 commit comments