File: zonetab2pot.py

package info (click to toggle)
kde-dev-scripts 4%3A25.04.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 3,612 kB
  • sloc: perl: 15,615; lisp: 5,627; sh: 4,560; python: 3,892; ruby: 1,386; makefile: 13; sed: 9
file content (23 lines) | stat: -rwxr-xr-x 663 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/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 <lukas@kde.org>, 2002
'''

import sys
import fileinput

def makePOT(_file):
  for line in fileinput.input(_file):
    if (line[0]=='#'): #skip comments
      continue
    section=line.strip().split('\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")