comparison doc/setup.txt @ 49:daf35e2ad044

Support a `message_extractors` keyword argument directly in `setup()`. Closes #4.
author cmlenz
date Thu, 07 Jun 2007 00:15:27 +0000
parents 4525549aa6cc
children 7f61453c1bea
comparison
equal deleted inserted replaced
48:bd647e3760e0 49:daf35e2ad044
44 --quiet (-q) run quietly (turns verbosity off) 44 --quiet (-q) run quietly (turns verbosity off)
45 --dry-run (-n) don't actually do anything 45 --dry-run (-n) don't actually do anything
46 --help (-h) show detailed help message 46 --help (-h) show detailed help message
47 47
48 Options for 'extract_messages' command: 48 Options for 'extract_messages' command:
49 --charset charset to use in the output 49 --charset charset to use in the output file
50 --keywords (-k) comma-separated list of keywords to look for in addition 50 --keywords (-k) space-separated list of keywords to look for in
51 to the defaults 51 addition to the defaults
52 --no-location do not write filename/lineno location comments 52 --no-default-keywords do not include the default keywords
53 --output-file filename of the output PO file 53 --mapping-file (-F) path to the mapping configuration file
54 --no-location do not include location comments with filename and
55 line number
56 --omit-header do not include msgid "" entry in header
57 --output-file (-o) name of the output file
58 --width (-w) set output line width (default 76)
59 --no-wrap do not break long message lines, longer than the
60 output line width, into several lines
54 61
55 Running the command will produce a PO file:: 62 Running the command will produce a PO file::
56 63
57 $ ./setup.py extract_messages --output-file webapp/locales/messages.pot 64 $ ./setup.py extract_messages --output-file foobar/locale/messages.pot
58 running extract_messages 65 running extract_messages
59 extracting messages from 'webapp' 66 extracting messages from foobar/__init__.py
60 extracting messages from 'webparts' 67 extracting messages from foobar/core.py
61 writing PO file to webapp/locales/messages.pot 68 ...
69 writing PO file to foobar/locale/messages.pot
70
71
72 Method Mapping
73 --------------
74
75 The mapping of file patterns to extraction methods (and options) can be
76 specified using a configuration file that is pointed to using the
77 ``--mapping-file`` option shown above. Alternatively, you can configure the
78 mapping directly in ``setup.py`` using a keyword argument to the ``setup()``
79 function:
80
81 .. code-block:: python
82
83 setup(...
84
85 message_extractors = {
86 'foobar/**.py': ('python', None),
87 'foobar/**/templates/**.html': ('genshi', None),
88 'foobar/**/templates/**.txt': ('genshi', {
89 'template_class': 'genshi.template.text.TextTemplate'
90 })
91 },
92
93 ...
94 )
62 95
63 96
64 Options 97 Options
65 ------- 98 -------
66 99
67 As shown in the ``--help`` output above, the ``extract_messages`` command 100 As shown in the ``--help`` output above, the ``extract_messages`` command
68 accepts the following options: 101 accepts the following options:
69 102
70 ``--charset`` 103 +-----------------------------+----------------------------------------------+
71 The character set / encoding to use in the generated PO file. 104 | Option | Description |
72 ``--keywords`` 105 +=============================+==============================================+
73 A comma-separated list of keywords (function names) to look for in addition 106 | ``--charset`` | charset to use in the output file |
74 to the default keywords 107 +-----------------------------+----------------------------------------------+
75 ``--no-location`` 108 | ``--keywords`` (``-k``) | space-separated list of keywords to look for |
76 If this flag is set, location comments will not be included in the generated 109 | | in addition to the defaults |
77 PO file. 110 +-----------------------------+----------------------------------------------+
78 ``--output-file`` or ``-o`` 111 | ``--no-default-keywords`` | do not include the default keywords |
79 The path to the PO file that should be generated 112 +-----------------------------+----------------------------------------------+
80 113 | ``--mapping-file`` (``-F``) | path to the mapping configuration file |
114 +-----------------------------+----------------------------------------------+
115 | ``--no-location`` | do not include location comments with |
116 | | filename and line number |
117 +-----------------------------+----------------------------------------------+
118 | ``--omit-header`` | do not include msgid "" entry in header |
119 +-----------------------------+----------------------------------------------+
120 | ``--output-file`` (``-o``) | name of the output file |
121 +-----------------------------+----------------------------------------------+
122 | ``--width`` (``-w``) | set output line width (default 76) |
123 +-----------------------------+----------------------------------------------+
124 | ``--no-wrap`` | do not break long message lines, longer than |
125 | | the output line width, into several lines |
126 +-----------------------------+----------------------------------------------+
Copyright (C) 2012-2017 Edgewall Software