comparison doc/setup.txt @ 162:661cb602781d

Add MO file generation. Closes #21.
author cmlenz
date Thu, 21 Jun 2007 14:38:30 +0000
parents 24b5de939850
children 6138ea7ef7a8
comparison
equal deleted inserted replaced
160:b5659b7779be 162:661cb602781d
17 from distutils.core import setup 17 from distutils.core import setup
18 from babel.messages import frontend as babel 18 from babel.messages import frontend as babel
19 19
20 setup( 20 setup(
21 ... 21 ...
22 cmd_class = {'extract_messages': babel.extract_messages, 22 cmd_class = {'compile_catalog': babel.compile_catalog,
23 'extract_messages': babel.extract_messages,
23 'new_catalog': babel.new_catalog} 24 'new_catalog': babel.new_catalog}
24 ) 25 )
25 26
26 27
27 .. contents:: Contents 28 .. contents:: Contents
28 :depth: 2 29 :depth: 2
29 .. sectnum:: 30 .. sectnum::
30 31
31 32
33 compile_catalog
34 ===============
35
36 The ``compile_catalog`` command is similar to the GNU ``msgfmt`` tool, in that
37 it takes a message catalog from a PO file and compiles it to a binary MO file.
38
39 If the command has been correctly installed or registered, a project's
40 ``setup.py`` script should allow you to use the command::
41
42 $ ./setup.py compile_catalog --help
43 Global options:
44 --verbose (-v) run verbosely (default)
45 --quiet (-q) run quietly (turns verbosity off)
46 --dry-run (-n) don't actually do anything
47 --help (-h) show detailed help message
48
49 Options for 'compile_catalog' command:
50 ...
51
52 Running the command will produce a PO template file::
53
54 $ ./setup.py compile_catalog --directory foobar/locale --locale pt_BR
55 running compile_catalog
56 compiling catalog to to foobar/locale/pt_BR/LC_MESSAGES/messages.mo
57
58
59 Options
60 -------
61
62 The ``compile_catalog`` command accepts the following options:
63
64 +-----------------------------+----------------------------------------------+
65 | Option | Description |
66 +=============================+==============================================+
67 | ``--domain`` | domain of the PO file (defaults to |
68 | | lower-cased project name) |
69 +-----------------------------+----------------------------------------------+
70 | ``--directory`` (``-d``) | name of the base directory |
71 +-----------------------------+----------------------------------------------+
72 | ``--input-file`` (``-i``) | name of the input file |
73 +-----------------------------+----------------------------------------------+
74 | ``--output-file`` (``-o``) | name of the output file |
75 +-----------------------------+----------------------------------------------+
76 | ``--locale`` | locale for the new localized string |
77 +-----------------------------+----------------------------------------------+
78 | ``--use-fuzzy`` | also include "fuzzy" translations |
79 +-----------------------------+----------------------------------------------+
80
81 If ``directory`` is specified, but ``output-file`` is not, the default filename
82 of the output file will be::
83
84 <output_dir>/<locale>/LC_MESSAGES/<domain>.mo
85
86 These options can either be specified on the command-line, or in the
87 ``setup.cfg`` file.
88
89
32 extract_messages 90 extract_messages
33 ================ 91 ================
34 92
35 The ``extract_messages`` command is comparable to the GNU ``xgettext`` program: 93 The ``extract_messages`` command is comparable to the GNU ``xgettext`` program:
36 it can extract localizable messages from a variety of difference source files, 94 it can extract localizable messages from a variety of difference source files,
37 and generate a PO (portable object) template file from the collected messages. 95 and generate a PO (portable object) template file from the collected messages.
38 96
39 If the command has been correctly installed or registered, another project's 97 If the command has been correctly installed or registered, a project's
40 ``setup.py`` script should allow you to use the command:: 98 ``setup.py`` script should allow you to use the command::
41 99
42 $ ./setup.py extract_messages --help 100 $ ./setup.py extract_messages --help
43 Global options: 101 Global options:
44 --verbose (-v) run verbosely (default) 102 --verbose (-v) run verbosely (default)
156 =========== 214 ===========
157 215
158 The ``new_catalog`` command is basically equivalent to the GNU ``msginit`` 216 The ``new_catalog`` command is basically equivalent to the GNU ``msginit``
159 program: it creates a new translation catalog based on a PO template file (POT). 217 program: it creates a new translation catalog based on a PO template file (POT).
160 218
161 If the command has been correctly installed or registered, another project's 219 If the command has been correctly installed or registered, a project's
162 ``setup.py`` script should allow you to use the command:: 220 ``setup.py`` script should allow you to use the command::
163 221
164 $ ./setup.py new_catalog --help 222 $ ./setup.py new_catalog --help
165 Global options: 223 Global options:
166 --verbose (-v) run verbosely (default) 224 --verbose (-v) run verbosely (default)
Copyright (C) 2012-2017 Edgewall Software