annotate doc/setup.txt @ 47:f8469ab4b257 trunk

Support passing extraction method mapping and options from the frontends (see #4). No distutils/setuptools keyword supported yet, but the rest seems to be working okay.
author cmlenz
date Wed, 06 Jun 2007 21:03:24 +0000
parents 0739bc8e7210
children 37bd476dafe4
rev   line source
2
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
1 .. -*- mode: rst; encoding: utf-8 -*-
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
2
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
3 ================================
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
4 Distutils/Setuptools Integration
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
5 ================================
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
6
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
7 Babel provides commands for integration into ``setup.py`` scripts, based on
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
8 either the ``distutils`` package that is part of the Python standard library,
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
9 or the third-party ``setuptools`` package.
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
10
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
11 These commands are available by default when Babel has been properly installed,
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
12 and ``setup.py`` is using ``setuptools``. For projects that use plain old
40
0739bc8e7210 Syntax highlighting for the docs.
cmlenz
parents: 2
diff changeset
13 ``distutils``, the commands need to be registered explicitly, for example:
0739bc8e7210 Syntax highlighting for the docs.
cmlenz
parents: 2
diff changeset
14
0739bc8e7210 Syntax highlighting for the docs.
cmlenz
parents: 2
diff changeset
15 .. code-block:: python
2
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
16
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
17 from distutils.core import setup
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
18 from babel.catalog import frontend as babel
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
19
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
20 setup(
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
21 ...
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
22 cmd_class = {'extract_messages': babel.extract_messages}
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
23 )
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
24
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
25
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
26 .. contents:: Contents
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
27 :depth: 2
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
28 .. sectnum::
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
29
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
30
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
31 extract_messages
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
32 ================
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
33
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
34 The ``extract_messages`` command is comparabe to the GNU ``xgettext`` program:
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
35 it can extract localizable messages from a variety of difference source files,
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
36 and generate a PO (portable object) template file from the collected messages.
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
37
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
38 If the command has been correctly installed or registered, another project's
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
39 ``setup.py`` script should allow you to use the command::
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
40
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
41 $ ./setup.py extract_messages --help
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
42 Global options:
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
43 --verbose (-v) run verbosely (default)
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
44 --quiet (-q) run quietly (turns verbosity off)
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
45 --dry-run (-n) don't actually do anything
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
46 --help (-h) show detailed help message
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
47
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
48 Options for 'extract_messages' command:
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
49 --charset charset to use in the output
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
50 --keywords (-k) comma-separated list of keywords to look for in addition
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
51 to the defaults
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
52 --no-location do not write filename/lineno location comments
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
53 --output-file filename of the output PO file
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
54
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
55 Running the command will produce a PO file::
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
56
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
57 $ ./setup.py extract_messages --output-file webapp/locales/messages.pot
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
58 running extract_messages
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
59 extracting messages from 'webapp'
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
60 extracting messages from 'webparts'
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
61 writing PO file to webapp/locales/messages.pot
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
62
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
63
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
64 Options
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
65 -------
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
66
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
67 As shown in the ``--help`` output above, the ``extract_messages`` command
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
68 accepts the following options:
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
69
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
70 ``--charset``
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
71 The character set / encoding to use in the generated PO file.
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
72 ``--keywords``
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
73 A comma-separated list of keywords (function names) to look for in addition
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
74 to the default keywords
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
75 ``--no-location``
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
76 If this flag is set, location comments will not be included in the generated
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
77 PO file.
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
78 ``--output-file`` or ``-o``
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
79 The path to the PO file that should be generated
20896f1e91c6 Forgot to check in the doc directory.
cmlenz
parents:
diff changeset
80
Copyright (C) 2012-2017 Edgewall Software