Mercurial > babel > old > mirror
comparison 0.9.x/doc/cmdline.txt @ 263:5b7d3f9f7d74 stable
Create branch for 0.9.x maintenance.
author | cmlenz |
---|---|
date | Mon, 20 Aug 2007 08:34:32 +0000 |
parents | |
children | f2d6c593bc43 |
comparison
equal
deleted
inserted
replaced
197:79565db4faf0 | 263:5b7d3f9f7d74 |
---|---|
1 .. -*- mode: rst; encoding: utf-8 -*- | |
2 | |
3 ====================== | |
4 Command-Line Interface | |
5 ====================== | |
6 | |
7 Babel includes a command-line interface for working with message catalogs, | |
8 similar to the various GNU ``gettext`` tools commonly available on Linux/Unix | |
9 systems. | |
10 | |
11 | |
12 .. contents:: Contents | |
13 :depth: 2 | |
14 .. sectnum:: | |
15 | |
16 | |
17 When properly installed, Babel provides a script called ``pybabel``:: | |
18 | |
19 $ pybabel --help | |
20 usage: pybabel subcommand [options] [args] | |
21 | |
22 options: | |
23 --version show program's version number and exit | |
24 -h, --help show this help message and exit | |
25 | |
26 subcommands: | |
27 compile compile message catalogs to MO files | |
28 extract extract messages from source files and generate a POT file | |
29 init create new message catalogs from a POT file | |
30 update update existing message catalogs from a POT file | |
31 | |
32 The ``pybabel`` script provides a number of sub-commands that do the actual | |
33 work. Those sub-commands are described below. | |
34 | |
35 | |
36 compile | |
37 ======= | |
38 | |
39 The ``compile`` sub-command can be used to compile translation catalogs into | |
40 binary MO files:: | |
41 | |
42 $ pybabel compile --help | |
43 usage: pybabel compile [options] | |
44 | |
45 compile message catalogs to MO files | |
46 | |
47 options: | |
48 -h, --help show this help message and exit | |
49 -D DOMAIN, --domain=DOMAIN | |
50 domain of MO and PO files (default 'messages') | |
51 -d DIR, --directory=DIR | |
52 base directory of catalog files | |
53 -l LOCALE, --locale=LOCALE | |
54 locale of the catalog | |
55 -i FILE, --input-file=FILE | |
56 name of the input file | |
57 -o FILE, --output-file=FILE | |
58 name of the output file (default | |
59 '<output_dir>/<locale>/LC_MESSAGES/<domain>.mo') | |
60 -f, --use-fuzzy also include fuzzy translations (default False) | |
61 | |
62 If ``directory`` is specified, but ``output-file`` is not, the default filename | |
63 of the output file will be:: | |
64 | |
65 <directory>/<locale>/LC_MESSAGES/<domain>.mo | |
66 | |
67 If neither the ``input_file`` nor the ``locale`` option is set, this command | |
68 looks for all catalog files in the base directory that match the given domain, | |
69 and compiles each of them to MO files in the same directory. | |
70 | |
71 | |
72 | |
73 extract | |
74 ======= | |
75 | |
76 The ``extract`` sub-command can be used to extract localizable messages from | |
77 a collection of source files:: | |
78 | |
79 $ pybabel extract --help | |
80 usage: pybabel extract [options] dir1 <dir2> ... | |
81 | |
82 extract messages from source files and generate a POT file | |
83 | |
84 options: | |
85 -h, --help show this help message and exit | |
86 --charset=CHARSET charset to use in the output | |
87 -k KEYWORDS, --keyword=KEYWORDS | |
88 keywords to look for in addition to the defaults. You | |
89 can specify multiple -k flags on the command line. | |
90 --no-default-keywords | |
91 do not include the default keywords | |
92 -F MAPPING_FILE, --mapping=MAPPING_FILE | |
93 path to the extraction mapping file | |
94 --no-location do not include location comments with filename and | |
95 line number | |
96 --omit-header do not include msgid "" entry in header | |
97 -o OUTPUT, --output=OUTPUT | |
98 path to the output POT file | |
99 -w WIDTH, --width=WIDTH | |
100 set output line width (default 76) | |
101 --no-wrap do not break long message lines, longer than the | |
102 output line width, into several lines | |
103 --sort-output generate sorted output (default False) | |
104 --sort-by-file sort output by file location (default False) | |
105 --msgid-bugs-address=EMAIL@ADDRESS | |
106 set report address for msgid | |
107 --copyright-holder=COPYRIGHT_HOLDER | |
108 set copyright holder in output | |
109 -c TAG, --add-comments=TAG | |
110 place comment block with TAG (or those preceding | |
111 keyword lines) in output file. One TAG per argument | |
112 call | |
113 | |
114 | |
115 init | |
116 ==== | |
117 | |
118 The `init` sub-command creates a new translations catalog based on a PO | |
119 template file:: | |
120 | |
121 $ pybabel init --help | |
122 usage: pybabel init [options] | |
123 | |
124 create new message catalogs from a POT file | |
125 | |
126 options: | |
127 -h, --help show this help message and exit | |
128 -D DOMAIN, --domain=DOMAIN | |
129 domain of PO file (defaults to lower-cased project | |
130 name) | |
131 -i INPUT_FILE, --input-file=INPUT_FILE | |
132 name of the input file | |
133 -d OUTPUT_DIR, --output-dir=OUTPUT_DIR | |
134 path to output directory | |
135 -o OUTPUT_FILE, --output-file=OUTPUT_FILE | |
136 name of the output file (default | |
137 '<output_dir>/<locale>/<domain>.po') | |
138 -l LOCALE, --locale=LOCALE | |
139 locale for the new localized catalog | |
140 --first-author=FIRST_AUTHOR_NAME | |
141 name of first author | |
142 --first-author-email=FIRST_AUTHOR_EMAIL | |
143 email of first author | |
144 --project-name=NAME the project name | |
145 --project-version=VERSION | |
146 the project version | |
147 | |
148 | |
149 update | |
150 ====== | |
151 | |
152 The `update` sub-command updates an existing new translations catalog based on | |
153 a PO template file:: | |
154 | |
155 $ pybabel update --help | |
156 usage: pybabel update [options] | |
157 | |
158 update existing message catalogs from a POT file | |
159 | |
160 options: | |
161 -h, --help show this help message and exit | |
162 -D DOMAIN, --domain=DOMAIN | |
163 domain of PO file (default 'messages') | |
164 -i FILE, --input-file=FILE | |
165 name of the input file | |
166 -d DIR, --output-dir=DIR | |
167 path to output directory | |
168 -o FILE, --output-file=FILE | |
169 name of the output file (default | |
170 '<output_dir>/<locale>/LC_MESSAGES/<domain>.po') | |
171 -l LOCALE, --locale=LOCALE | |
172 locale of the translations catalog | |
173 --ignore-obsolete do not include obsolete messages in the output | |
174 (default False) | |
175 | |
176 If ``output_dir`` is specified, but ``output-file`` is not, the default | |
177 filename of the output file will be:: | |
178 | |
179 <directory>/<locale>/LC_MESSAGES/<domain>.mo | |
180 | |
181 If neither the ``output_file`` nor the ``locale`` option is set, this command | |
182 looks for all catalog files in the base directory that match the given domain, | |
183 and updates each of them. |