diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index 2c6e171..82eacdb 100755
a
|
b
|
def copy_plural_forms(msgs, locale, domain, verbosity):
|
115 | 115 | |
116 | 116 | def make_messages(locale=None, domain='django', verbosity='1', all=False, |
117 | 117 | extensions=None, symlinks=False, ignore_patterns=[], no_wrap=False, |
118 | | no_obsolete=False): |
| 118 | no_obsolete=False, keep_pot=False): |
119 | 119 | """ |
120 | 120 | Uses the locale directory from the Django SVN tree or an application/ |
121 | 121 | project to process all |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
201 | 201 | msgs, errors = _popen(cmd) |
202 | 202 | if errors: |
203 | 203 | os.unlink(os.path.join(dirpath, thefile)) |
204 | | if os.path.exists(potfile): |
| 204 | if os.path.exists(potfile) and not keep_pot: |
205 | 205 | os.unlink(potfile) |
206 | 206 | raise CommandError( |
207 | 207 | "errors happened while running xgettext on %s\n%s" % |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
248 | 248 | if errors: |
249 | 249 | if thefile != file: |
250 | 250 | os.unlink(os.path.join(dirpath, thefile)) |
251 | | if os.path.exists(potfile): |
| 251 | if os.path.exists(potfile) and not keep_pot: |
252 | 252 | os.unlink(potfile) |
253 | 253 | raise CommandError( |
254 | 254 | "errors happened while running xgettext on %s\n%s" % |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
275 | 275 | msgs, errors = _popen('msguniq %s --to-code=utf-8 "%s"' % |
276 | 276 | (wrap, potfile)) |
277 | 277 | if errors: |
278 | | os.unlink(potfile) |
| 278 | if not keep_pot: |
| 279 | os.unlink(potfile) |
279 | 280 | raise CommandError( |
280 | 281 | "errors happened while running msguniq\n%s" % errors) |
281 | 282 | if os.path.exists(pofile): |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
287 | 288 | msgs, errors = _popen('msgmerge %s -q "%s" "%s"' % |
288 | 289 | (wrap, pofile, potfile)) |
289 | 290 | if errors: |
290 | | os.unlink(potfile) |
| 291 | if not keep_pot: |
| 292 | os.unlink(potfile) |
291 | 293 | raise CommandError( |
292 | 294 | "errors happened while running msgmerge\n%s" % errors) |
293 | 295 | elif not invoked_for_django: |
… |
… |
def make_messages(locale=None, domain='django', verbosity='1', all=False,
|
299 | 301 | f.write(msgs) |
300 | 302 | finally: |
301 | 303 | f.close() |
302 | | os.unlink(potfile) |
| 304 | if not keep_pot: |
| 305 | os.unlink(potfile) |
303 | 306 | if no_obsolete: |
304 | 307 | msgs, errors = _popen('msgattrib %s -o "%s" --no-obsolete "%s"' % |
305 | 308 | (wrap, pofile, pofile)) |
… |
… |
class Command(NoArgsCommand):
|
329 | 332 | default=False, help="Don't break long message lines into several lines"), |
330 | 333 | make_option('--no-obsolete', action='store_true', dest='no_obsolete', |
331 | 334 | default=False, help="Remove obsolete message strings"), |
| 335 | make_option('--keep-pot', action='store_true', dest='keep_pot', |
| 336 | default=False, help="Keep .pot file after making messages. Useful when debugging."), |
| 337 | |
332 | 338 | ) |
333 | 339 | help = ( "Runs over the entire source tree of the current directory and " |
334 | 340 | "pulls out all strings marked for translation. It creates (or updates) a message " |
… |
… |
class Command(NoArgsCommand):
|
352 | 358 | ignore_patterns = list(set(ignore_patterns)) |
353 | 359 | no_wrap = options.get('no_wrap') |
354 | 360 | no_obsolete = options.get('no_obsolete') |
| 361 | keep_pot = options.get('keep_pot') |
355 | 362 | if domain == 'djangojs': |
356 | 363 | extensions = handle_extensions(extensions or ['js']) |
357 | 364 | else: |
… |
… |
class Command(NoArgsCommand):
|
361 | 368 | sys.stdout.write('examining files with the extensions: %s\n' |
362 | 369 | % get_text_list(list(extensions), 'and')) |
363 | 370 | |
364 | | make_messages(locale, domain, verbosity, process_all, extensions, symlinks, ignore_patterns, no_wrap, no_obsolete) |
| 371 | make_messages(locale, domain, verbosity, process_all, extensions, symlinks, ignore_patterns, no_wrap, no_obsolete, keep_pot) |
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index c07b61c..0dfd325 100755
a
|
b
|
Use the ``--no-default-ignore`` option to disable the default values of
|
475 | 475 | Use the ``--no-wrap`` option to disable breaking long message lines into |
476 | 476 | several lines in language files. |
477 | 477 | |
| 478 | .. django-admin-option:: --keep-pot |
| 479 | |
| 480 | .. versionadded:: 1.4 |
| 481 | |
| 482 | Use the ``--keep-pot`` option to prevent django from deleting the temporary .pot file |
| 483 | it generates before creating the .po file. This is useful for debugging errors which |
| 484 | may prevent the final language files from being created. |
| 485 | |
478 | 486 | reset <appname appname ...> |
479 | 487 | --------------------------- |
480 | 488 | |