Prepare stub for actually loading po file
This commit is contained in:
parent
76ae1a508b
commit
6538ce2192
@ -7,11 +7,10 @@ class TranslationManager(models.Manager):
|
||||
'''
|
||||
Parses translation meta info and creates/updates translation object.
|
||||
'''
|
||||
print code
|
||||
lang = Language.objects.get(code = code)
|
||||
trans, created = self.get_or_create(
|
||||
language = lang,
|
||||
subproject = subproject,
|
||||
filename = path)
|
||||
print trans
|
||||
trans.update_from_blob(blob)
|
||||
|
||||
|
@ -161,6 +161,17 @@ class Translation(models.Model):
|
||||
def __unicode__(self):
|
||||
return '%s@%s' % (self.language.name, self.subproject.__unicode__())
|
||||
|
||||
def update_from_blob(self, blob):
|
||||
'''
|
||||
Updates translation data from blob.
|
||||
'''
|
||||
# Check if we're not already up to date
|
||||
if self.revision == blob.hexsha:
|
||||
return
|
||||
|
||||
oldunits = set(self.unit_set.all().values_list('id', flat = True))
|
||||
|
||||
|
||||
class Unit(models.Model):
|
||||
translation = models.ForeignKey(Translation)
|
||||
location = models.TextField()
|
||||
|
Loading…
Reference in New Issue
Block a user