Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ctl[domain] = catalog.MessageCatalog(domain=domain)
label = dict.get('label')
label_msgid = dict.get('label_msgid')
desc = norm(dict.get('description'))
desc_msgid = dict.get('description_msgid')
if label_msgid and label:
ctl[domain].add(label_msgid, label, references=['widget label of %s - description \"%s\"' % (w.getName(), desc)])
if desc_msgid and desc:
ctl[domain].add(desc_msgid, desc, references=['widget description of %s for label %s' % (w.getName(), label)])
domains = ctl.keys()
for domain in domains:
file = open('%s-generated.pot' % domain, 'w')
writer = catalog.POWriter(file, ctl[domain])
writer.write(sort=True, msgstrToComment=True)
po_ctl[new_domain][relocate_msgid] = msgstr
changes[new_domain] = True
print('copied msgstr for %s' % relocate_msgid)
#else:
# print '%s was already there' % relocate_msgid
else:
po_ctl[new_domain][relocate_msgid] = msgstr
changes[new_domain] = True
print('copied %s to %s-%s.po' % (relocate_msgid, new_domain, lang))
#else:
# print '%s was not found anymore' % relocate_msgid
for domain in changes:
if changes[domain]:
file = open('%s-%s.po' % (domain, lang), 'w')
writer = catalog.POWriter(file, po_ctl[domain])
writer.write(sort=True)
try:
msgids = po_ctl.keys()
if old in msgids:
if new in msgids:
print 'New message already in %s' % poFile
else:
po_ctl[new] = po_ctl.get(old)
del po_ctl[old]
print 'Rename %s to %s in file %s' % (old, new, poFile)
else:
print 'Old message not found in %s' % poFile
except IndexError:
print poFile
file = open(poFile+'-new', 'w')
writer = catalog.POWriter(file, po_ctl)
writer.write(sort=True)