summaryrefslogtreecommitdiff
path: root/gen_pot.py
blob: 90045ccc11e7c64f41d994e633fabcd881745972 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import sys
import os.path
import time
from gen_tzinfo import allzones

from pytz import __version__

boilerplate = r"""msgid ""
msgstr ""
"Project-Id-Version: pytz %s\n"
"POT-Creation-Date: %s\n"
"Content-Type: text/plain; charset=UTF-8\n"

""" % (
        __version__,
        time.strftime('%Y-%m-%d %H:%M+UTC', time.gmtime(time.time()))
        )

def main():
    assert len(sys.argv) == 2, 'Output file not specified on command line'
    pot_file_name = sys.argv[1]

    if not os.path.exists(os.path.dirname(pot_file_name)):
        os.makedirs(os.path.dirname(pot_file_name))

    pot = open(pot_file_name, 'wb')

    print >> pot, boilerplate
    
    for zone in allzones():
        print >> pot, 'msgid "%s"' % zone
        print >> pot, 'msgstr ""'
        print >> pot


if __name__ == '__main__':
    main()