コード例 #1
0
ファイル: transifex.py プロジェクト: ricklon/Arduino
  def pull(self, lang, fname):
    new = self.translation(lang).encode('utf-8')
    new = map(lambda a: a + '\n', new.split('\n'))
    new = update.read_po(new)

    catalog = update.read_po(fname)
    update.merge(catalog, new)

    update.dump(catalog, fname)
コード例 #2
0
  def pull(self, lang, fname):
    new = self.translation(lang).encode('utf-8')
    new = map(lambda a: a + '\n', new.split('\n'))
    new = update.read_po(new)

    # remove the key '' to preserve the first comment block.
    first = new.pop('', ('', '', ''))  

    catalog = update.read_po(fname)
    update.merge(catalog, new)
    (comment, rkey, rvalue) = catalog.get('', ('', 'msgid ""\n', ''))
    catalog[''] = (comment, rkey, first[2])

    update.dump(catalog, fname)