/usr/bin/POFileClean is in gettext-lint 0.4-2.1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #!/usr/bin/python
# -*- mode: Python; coding: utf-8; -*-
# Resets the msgstr for situations where it's just a copy of msgid
#
# Pedro Morais <morais@kde.org>
# José Nuno Pires <jncp@netcabo.pt>
# João Miguel Neves <joao@silvaneves.org>
# (c) Copyright 2003 - 2006
# Distributable under the terms of the GPL - see COPYING
import sys
import getopt
if not "/usr/share/gettext-lint" in sys.path:
sys.path.append("/usr/share/gettext-lint")
from POFile import POFile
def usage(code = -1):
w = sys.stderr.write
w('Usage: POFileClean <OPTION> <TARGET FILE>...\n')
w('\n')
w('Options:\n')
w(' -h, --help show this help\n')
sys.exit(code)
try:
opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])
except getopt.GetoptError:
usage()
for o, a in opts:
if o in ("-h", "--help"):
usage(0)
if len(args) != 1: usage()
map = None
target = POFile(args[0])
if target.parse() == 0:
sys.stderr.write('error parsing target file %s\n' % target.filename)
sys.exit(-2)
for i in target.data:
line, message, msgid, msgstr, fuzzy = i
if (msgid == msgstr):
newmsgstr = ""
po = POFile(target.filename)
lines = po.prepare_replace(message)
if lines != None:
file = open(target.filename, 'w')
po.execute_replace(lines, newmsgstr, 1, file)
file.close()
|