2012-02-28 15:20:44 +01:00
|
|
|
from django.core.management.base import BaseCommand, CommandError
|
|
|
|
from trans.models import SubProject
|
2012-02-28 15:25:30 +01:00
|
|
|
from optparse import make_option
|
2012-02-28 15:20:44 +01:00
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
help = '(re)loads translations from disk'
|
|
|
|
args = '<project/subproject>'
|
2012-02-28 15:25:30 +01:00
|
|
|
option_list = BaseCommand.option_list + (
|
|
|
|
make_option('--force',
|
|
|
|
action='store_true',
|
|
|
|
dest='force',
|
|
|
|
default=False,
|
|
|
|
help='Force rereading files even when they should be up to date'),
|
|
|
|
)
|
2012-02-28 15:20:44 +01:00
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
for arg in args:
|
|
|
|
prj, subprj = arg.split('/')
|
2012-02-28 15:25:30 +01:00
|
|
|
s = SubProject.objects.get(slug = subprj, project__slug = prj)
|
|
|
|
s.create_translations(options['force'])
|