comparison babel/messages/extract.py @ 82:0b5d604399b8

Missed some param's documentation regarding translator comments.
author palgarvio
date Sun, 10 Jun 2007 16:46:55 +0000
parents 1e89661e6b26
children 4ff9cc26c11b
comparison
equal deleted inserted replaced
81:1e89661e6b26 82:0b5d604399b8
53 comments_tags=[], callback=None): 53 comments_tags=[], callback=None):
54 """Extract messages from any source files found in the given directory. 54 """Extract messages from any source files found in the given directory.
55 55
56 This function generates tuples of the form: 56 This function generates tuples of the form:
57 57
58 ``(filename, lineno, message)`` 58 ``(filename, lineno, message, comments)``
59 59
60 Which extraction method is used per file is determined by the `method_map` 60 Which extraction method is used per file is determined by the `method_map`
61 parameter, which maps extended glob patterns to extraction method names. 61 parameter, which maps extended glob patterns to extraction method names.
62 For example, the following is the default mapping: 62 For example, the following is the default mapping:
63 63
104 :param options_map: a dictionary of additional options (optional) 104 :param options_map: a dictionary of additional options (optional)
105 :param keywords: a dictionary mapping keywords (i.e. names of functions 105 :param keywords: a dictionary mapping keywords (i.e. names of functions
106 that should be recognized as translation functions) to 106 that should be recognized as translation functions) to
107 tuples that specify which of their arguments contain 107 tuples that specify which of their arguments contain
108 localizable strings 108 localizable strings
109 :param comments_tags: a list of translator tags to search for and include
110 in output
109 :param callback: a function that is called for every file that message are 111 :param callback: a function that is called for every file that message are
110 extracted from, just before the extraction itself is 112 extracted from, just before the extraction itself is
111 performed; the function is passed the filename, the name 113 performed; the function is passed the filename, the name
112 of the extraction method and and the options dictionary as 114 of the extraction method and and the options dictionary as
113 positional arguments, in that order 115 positional arguments, in that order
157 :param method: a string specifying the extraction method (.e.g. "python") 159 :param method: a string specifying the extraction method (.e.g. "python")
158 :param keywords: a dictionary mapping keywords (i.e. names of functions 160 :param keywords: a dictionary mapping keywords (i.e. names of functions
159 that should be recognized as translation functions) to 161 that should be recognized as translation functions) to
160 tuples that specify which of their arguments contain 162 tuples that specify which of their arguments contain
161 localizable strings 163 localizable strings
164 :param comments_tags: a list of translator tags to search for and include
165 in output
162 :param options: a dictionary of additional options (optional) 166 :param options: a dictionary of additional options (optional)
163 :return: the list of extracted messages 167 :return: the list of extracted messages
164 :rtype: `list` 168 :rtype: `list`
165 """ 169 """
166 fileobj = open(filename, 'U') 170 fileobj = open(filename, 'U')
196 :param fileobj: the file-like object the messages should be extracted from 200 :param fileobj: the file-like object the messages should be extracted from
197 :param keywords: a dictionary mapping keywords (i.e. names of functions 201 :param keywords: a dictionary mapping keywords (i.e. names of functions
198 that should be recognized as translation functions) to 202 that should be recognized as translation functions) to
199 tuples that specify which of their arguments contain 203 tuples that specify which of their arguments contain
200 localizable strings 204 localizable strings
201 :param comments_tags: a list of translator tags to search for and include in 205 :param comments_tags: a list of translator tags to search for and include
202 output 206 in output
203 :param options: a dictionary of additional options (optional) 207 :param options: a dictionary of additional options (optional)
204 :return: the list of extracted messages 208 :return: the list of extracted messages
205 :rtype: `list` 209 :rtype: `list`
206 :raise ValueError: if the extraction method is not registered 210 :raise ValueError: if the extraction method is not registered
207 """ 211 """
237 """Extract messages from Genshi templates. 241 """Extract messages from Genshi templates.
238 242
239 :param fileobj: the file-like object the messages should be extracted from 243 :param fileobj: the file-like object the messages should be extracted from
240 :param keywords: a list of keywords (i.e. function names) that should be 244 :param keywords: a list of keywords (i.e. function names) that should be
241 recognized as translation functions 245 recognized as translation functions
242 :param comments_tags: a list of translator tags to search for and include in 246 :param comments_tags: a list of translator tags to search for and include
243 output 247 in output
244 :param options: a dictionary of additional options (optional) 248 :param options: a dictionary of additional options (optional)
245 :return: an iterator over ``(lineno, funcname, message, comments)`` tuples 249 :return: an iterator over ``(lineno, funcname, message, comments)`` tuples
246 :rtype: ``iterator`` 250 :rtype: ``iterator``
247 """ 251 """
248 from genshi.filters.i18n import Translator 252 from genshi.filters.i18n import Translator
272 """Extract messages from Python source code. 276 """Extract messages from Python source code.
273 277
274 :param fileobj: the file-like object the messages should be extracted from 278 :param fileobj: the file-like object the messages should be extracted from
275 :param keywords: a list of keywords (i.e. function names) that should be 279 :param keywords: a list of keywords (i.e. function names) that should be
276 recognized as translation functions 280 recognized as translation functions
277 :param comments_tags: a list of translator tags to search for and include in 281 :param comments_tags: a list of translator tags to search for and include
278 output 282 in output
279 :param options: a dictionary of additional options (optional) 283 :param options: a dictionary of additional options (optional)
280 :return: an iterator over ``(lineno, funcname, message, comments)`` tuples 284 :return: an iterator over ``(lineno, funcname, message, comments)`` tuples
281 :rtype: ``iterator`` 285 :rtype: ``iterator``
282 """ 286 """
283 funcname = None 287 funcname = None
Copyright (C) 2012-2017 Edgewall Software