pseudo.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:mos-horizon 作者: Mirantis 项目源码 文件源码
def main():
    # Check arguments
    parser = argparse.ArgumentParser()
    parser.add_argument('pot_filename', type=argparse.FileType('r'))
    parser.add_argument('po_filename', type=argparse.FileType('w'))
    parser.add_argument('locale')
    args = parser.parse_args()

    # read POT file
    pot_cat = pofile.read_po(args.pot_filename, ignore_obsolete=True)

    # Create the new Catalog
    new_cat = catalog.Catalog(locale=args.locale,
                              last_translator="pseudo.py",
                              charset="utf-8")
    num_plurals = new_cat.num_plurals

    # Process messages from template
    for msg in pot_cat:
        if msg.pluralizable:
            msg.string = [translate(u"{}:{}".format(i, msg.id[0]))
                          for i in range(num_plurals)]
        else:
            msg.string = translate(msg.id)
        new_cat[msg.id] = msg

    # Write "translated" PO file
    pofile.write_po(args.po_filename, new_cat, ignore_obsolete=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号