makemessages.py 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. from django.core.management.commands.makemessages import Command as BaseCommand
  2. class Command(BaseCommand):
  3. help = ("Runs over the entire source tree of the current directory and "
  4. "pulls out all strings marked for translation. It creates (or updates) a message "
  5. "file in the conf/locale (in the django tree) or locale (for projects and "
  6. "applications) directory.\n\nIf command is executed for JavaScript files, it "
  7. "also pulls strings from Misago Handlebars.js files.\n\nYou must run this "
  8. "command with one of either the --locale, --exclude or --all options.")
  9. JS_TEMPLATES = ('.hbs', '.handlebars')
  10. def handle(self, *args, **options):
  11. locale = options.get('locale')
  12. exclude = options.get('exclude')
  13. self.domain = options.get('domain')
  14. self.verbosity = options.get('verbosity')
  15. process_all = options.get('all')
  16. extensions = options.get('extensions')
  17. self.symlinks = options.get('symlinks')
  18. if self.domain == 'djangojs':
  19. # fake js files from templates
  20. self.prepare_tmp_js_templates();
  21. super(Command, self).handle(*args, **options)
  22. if self.domain == 'djangojs':
  23. # cleanup everything
  24. self.cleanup_po_files();
  25. self.cleanup_tmp_js_templates();
  26. def prepare_tmp_js_templates(self):
  27. pass
  28. def cleanup_po_files(self):
  29. pass
  30. def cleanup_tmp_js_templates(self):
  31. pass