OneClickInstaller: lng2po.py

File lng2po.py, 0.6 KB (added by MarianoReingart, 12 years ago)

Script para convertir los .LNG (Bitrock) a .PO (Pootle)

Line 
1# -*- coding: utf8 -*-
2
3
4def escape(s):
5    return s.replace("\\","\\\\") # test!
6
7lng = open(r"C:\Documents and Settings\Mariano\Escritorio\pg\oneclickinstaller\en.lng.wri")
8
9f = open(r"C:\Documents and Settings\Mariano\Escritorio\pg\oneclickinstaller\es.po","wb")
10
11for line in lng:
12    #import pdb; pdb.set_trace()
13    msg = line.split("=")
14    if len(msg)==2:
15        original = escape(msg[1]).encode("utf8").strip()
16        print original
17        translation = ""
18        f.write('msgid "%s"\n' % original )
19        f.write('msgstr "%s"\n\n' % translation)
20
21f.close()
22