summaryrefslogtreecommitdiffstats
path: root/scripts/zonetab2pot.py
blob: 2549e8e67a41f835e7552e62a0070e7441778f30 (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
#!/usr/bin/env python
'''This script reads timezone list as its first argument
or from /usr/share/zoneinfo/zone.tab, and converts it
to a PO file template.

This is free software, released under GPL.
Author: Lukas Tinkl <[email protected]>, 2002
'''

import sys
import fileinput
import string

def makePOT(_file):
  for line in fileinput.input(_file):
    if (line[0]=='#'): #skip comments
      continue
    section=string.split(string.strip(line), '\t')[2] #third field, tab separated
    newline='msgid \"' + section+ '\"\n' #msgid
    newline+='msgstr \"\"\n' #msgstr
    print(newline) #output to stdout

if __name__ == '__main__':
  makePOT(sys.argv[1:] or "/usr/share/zoneinfo/zone.tab")