fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
opds fix
[wolnelektury.git]
/
apps
/
modeltranslation
/
management
/
commands
/
translation2po.py
diff --git
a/apps/modeltranslation/management/commands/translation2po.py
b/apps/modeltranslation/management/commands/translation2po.py
index
57ef7fe
..
09eec1a
100644
(file)
--- a/
apps/modeltranslation/management/commands/translation2po.py
+++ b/
apps/modeltranslation/management/commands/translation2po.py
@@
-115,9
+115,13
@@
class Command(BaseCommand):
po = make_po(cur_lang)
pofiles[cur_lang] = po
po = make_po(cur_lang)
pofiles[cur_lang] = po
+ k = getattr(obj, '%s_%s' % (fld, settings.LANGUAGE_CODE))
+ if k is None: k = ''
+ v = getattr(obj, locfld)
+ if v is None: v = ''
entry = polib.POEntry(
entry = polib.POEntry(
- msgid=
getattr(obj, '%s_%s' % (fld, settings.LANGUAGE_CODE))
,
- msgstr=
getattr(obj, locfld)
,
+ msgid=
k
,
+ msgstr=
v
,
occurrences=[('%s/%s/%s' % (appname, md.__name__, locfld), obj.id)])
po.append(entry)
occurrences=[('%s/%s/%s' % (appname, md.__name__, locfld), obj.id)])
po.append(entry)
@@
-125,4
+129,5
@@
class Command(BaseCommand):
for lng, po in pofiles.items():
try: os.makedirs(os.path.join(directory, lng))
except OSError: pass
for lng, po in pofiles.items():
try: os.makedirs(os.path.join(directory, lng))
except OSError: pass
+ print lng, options
po.save(os.path.join(directory, lng, '%s.po' % options['poname']))
po.save(os.path.join(directory, lng, '%s.po' % options['poname']))