pcari.management.commands.makedbtrans module

Prepare a translation file from text stored in the database

class pcari.management.commands.makedbtrans.Command(stdout=None, stderr=None, no_color=False)

Bases: pcari.management.commands.BatchProcessingCommand

This command pulls text from the database and prepares them for translation.

OUTPUT_FILE_KEY = u'output-file'
add_arguments(parser)
help = u'Exports text fields in the database for translation'
postprocess(options)

Terminate the processing job (e.g. close files).

Parameters:options (dict) – Keyword arguments from the command line.
precondition_check(options, model, field)

Raise exceptions as necessary prior to processing model instances.

Parameters:
  • options (dict) – Keyword arguments from the command line.
  • model – The model to be inspected.
  • field – The field of model to be inspected.
Raises:

CommandError – if some precondition is not met.

preprocess(options)

Prepare to batch process all fields (e.g. open files).

Parameters:options (dict) – Keyword arguments from the command line.
process(options, instance, model_name, field_name)

Write strings to a .pot file that can be merged with Django’s own translations (i.e. django.pot) using GNU msgcat.