~robru/unity-firefox-extension/quantal-sru-candidate

« back to all changes in this revision

Viewing changes to po/update_template.py

  • Committer: Ken VanDine
  • Author(s): Michael Terry
  • Date: 2012-09-20 18:27:41 UTC
  • mfrom: (83.37.52)
  • Revision ID: ken.vandine@canonical.com-20120920182741-xdk72p2ui1ahn7xx
Tags: 2.3.2-0ubuntu1
* New upstream release
  - Fixes buggy test
  - Fixes xid ctype
* Rename source package to match upstream
* debian/tests:
  - Run test suite as a dep8 test (because it needs mozmill via pip)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
import polib
 
3
import sys
 
4
import optparse
 
5
 
 
6
parser = optparse.OptionParser(usage="usage: %prog path_to_eng_file")
 
7
 
 
8
(options, args) = parser.parse_args()
 
9
 
 
10
if args == None or len(args) != 1:
 
11
        print("ERROR: not enough arguments");
 
12
        sys.exit(1)
 
13
 
 
14
path = args[0]
 
15
 
 
16
po = polib.POFile()
 
17
po.metadata = {
 
18
    'Project-Id-Version': 'PACKAGE VERSION',
 
19
    'Report-Msgid-Bugs-To': 'you@example.com',
 
20
 
 
21
    'POT-Creation-Date': '2007-10-18 14:00+0100',
 
22
 
 
23
    'PO-Revision-Date': 'YEAR-MO-DA HO:MI+ZONE',
 
24
    'Last-Translator': 'FULL NAME <EMAIL@ADDRESS>',
 
25
    'Language-Team': 'LANGUAGE <LL@li.org>',
 
26
    'Language': '',
 
27
    'MIME-Version': '1.0',
 
28
    'Content-Type': 'text/plain; charset=utf-8',
 
29
    'Content-Transfer-Encoding': '8bit',
 
30
}
 
31
 
 
32
lines = open(path, 'r').readlines()
 
33
 
 
34
for i in range(len(lines)):
 
35
    line = lines[i]
 
36
    msg = line[line.find('=') + 1:].strip()
 
37
    entry = polib.POEntry(msgid=msg,
 
38
                          msgstr=u'',
 
39
                          occurrences=[('unity_webapps.properties', str(i))]
 
40
        )
 
41
    po.append(entry)
 
42
 
 
43
po.save('unity_firefox_extension.pot')