update and add more comments
svn: r20782
This commit is contained in:
parent
dbd8edaae6
commit
c2443c74d4
@ -548,6 +548,7 @@ def analyze_msgs( args, fname, msgs, nr_templates = None, nth = 0 ):
|
|||||||
|
|
||||||
for c in checks:
|
for c in checks:
|
||||||
c.summary()
|
c.summary()
|
||||||
|
c.diag()
|
||||||
|
|
||||||
po_coverage = (1.0 - (float(nr_untranslated) / float(nr_msgs))) * 100
|
po_coverage = (1.0 - (float(nr_untranslated) / float(nr_msgs))) * 100
|
||||||
print "%-20s%5.2f%%" % ( "PO Coverage:", po_coverage )
|
print "%-20s%5.2f%%" % ( "PO Coverage:", po_coverage )
|
||||||
@ -564,14 +565,13 @@ def analyze_msgs( args, fname, msgs, nr_templates = None, nth = 0 ):
|
|||||||
else:
|
else:
|
||||||
print text + ' (previous gramps.pot)'
|
print text + ' (previous gramps.pot)'
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
parser = ArgumentParser( description='This program validates a PO file for GRAMPS.')
|
parser = ArgumentParser( description='This program validates a PO file for GRAMPS.')
|
||||||
|
|
||||||
parser.add_argument("-s", dest="summary",
|
parser.add_argument("-s", dest="summary",
|
||||||
choices=[file for file in os.listdir('.') if file.endswith('.po')],
|
choices=[file for file in os.listdir('.') if file.endswith('.po')],
|
||||||
default=False, help="only give the summary")
|
default=False, help="the summary of check, and if need, it gives details")
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -52,6 +52,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
|
# Windows OS
|
||||||
|
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
# GetText Win 32 obtained from http://gnuwin32.sourceforge.net/packages/gettext.htm
|
# GetText Win 32 obtained from http://gnuwin32.sourceforge.net/packages/gettext.htm
|
||||||
@ -61,6 +62,9 @@ if sys.platform == 'win32':
|
|||||||
msgattribCmd = os.path.join('C:', 'Program Files(x86)', 'gettext', 'bin', 'msgattrib.exe')
|
msgattribCmd = os.path.join('C:', 'Program Files(x86)', 'gettext', 'bin', 'msgattrib.exe')
|
||||||
xgettextCmd = os.path.join('C:', 'Program Files(x86)', 'gettext', 'bin', 'xgettext.exe')
|
xgettextCmd = os.path.join('C:', 'Program Files(x86)', 'gettext', 'bin', 'xgettext.exe')
|
||||||
pythonCmd = os.path.join(sys.prefix, 'bin', 'python.exe')
|
pythonCmd = os.path.join(sys.prefix, 'bin', 'python.exe')
|
||||||
|
|
||||||
|
# Others OS
|
||||||
|
|
||||||
elif sys.platform == 'linux2' or os.name == 'darwin':
|
elif sys.platform == 'linux2' or os.name == 'darwin':
|
||||||
msgmergeCmd = 'msgmerge'
|
msgmergeCmd = 'msgmerge'
|
||||||
msgfmtCmd = 'msgfmt'
|
msgfmtCmd = 'msgfmt'
|
||||||
@ -70,9 +74,14 @@ elif sys.platform == 'linux2' or os.name == 'darwin':
|
|||||||
else:
|
else:
|
||||||
print ("ERROR: unknown system, don't know msgmerge, ... commands")
|
print ("ERROR: unknown system, don't know msgmerge, ... commands")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
# List of available languages, useful for grouped actions
|
||||||
|
|
||||||
|
# need files with po extension
|
||||||
LANG = [file for file in os.listdir('.') if file.endswith('.po')]
|
LANG = [file for file in os.listdir('.') if file.endswith('.po')]
|
||||||
|
# add a special 'all' argument (for 'check' and 'merge' arguments)
|
||||||
LANG.append("all")
|
LANG.append("all")
|
||||||
|
# visual polish on the languages list
|
||||||
LANG.sort()
|
LANG.sort()
|
||||||
|
|
||||||
def tests():
|
def tests():
|
||||||
@ -116,7 +125,7 @@ def tests():
|
|||||||
except:
|
except:
|
||||||
print ('Please, install python')
|
print ('Please, install python')
|
||||||
|
|
||||||
# See also 'get_string' from Gramps 2.0 (sample with SAX)
|
|
||||||
def TipsParse(filename, mark):
|
def TipsParse(filename, mark):
|
||||||
"""
|
"""
|
||||||
Experimental alternative to 'intltool-extract' for 'tips.xml'.
|
Experimental alternative to 'intltool-extract' for 'tips.xml'.
|
||||||
@ -205,6 +214,7 @@ def HolidaysParse(filename, mark):
|
|||||||
if key.attrib.get(mark):
|
if key.attrib.get(mark):
|
||||||
line = key.attrib
|
line = key.attrib
|
||||||
string = line.items
|
string = line.items
|
||||||
|
# mapping via the line dict (_name is the key)
|
||||||
name = 'char *s = N_("%(_name)s");\n' % line
|
name = 'char *s = N_("%(_name)s");\n' % line
|
||||||
holidays.write(name)
|
holidays.write(name)
|
||||||
holidays.close()
|
holidays.close()
|
||||||
@ -298,19 +308,19 @@ def KeyParse(filename, mark):
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
application/x-gramps-xml:
|
application/x-gramps-xml:
|
||||||
_description=Gramps XML database
|
_description=Gramps XML database
|
||||||
default_action_type=application
|
default_action_type=application
|
||||||
short_list_application_ids=gramps
|
short_list_application_ids=gramps
|
||||||
short_list_application_ids_for_novice_user_level=gramps
|
short_list_application_ids_for_novice_user_level=gramps
|
||||||
short_list_application_ids_for_intermediate_user_level=gramps
|
short_list_application_ids_for_intermediate_user_level=gramps
|
||||||
short_list_application_ids_for_advanced_user_level=gramps
|
short_list_application_ids_for_advanced_user_level=gramps
|
||||||
category=Documents/Genealogy
|
category=Documents/Genealogy
|
||||||
icon-filename=/usr/share/gramps/gramps.png
|
icon-filename=/usr/share/gramps/gramps.png
|
||||||
open=gramps %f
|
open=gramps %f
|
||||||
|
|
||||||
application/x-gedcom:
|
application/x-gedcom:
|
||||||
_description=GEDCOM
|
_description=GEDCOM
|
||||||
default_action_type=application
|
default_action_type=application
|
||||||
|
|
||||||
msgid "Gramps XML database"
|
msgid "Gramps XML database"
|
||||||
msgid "GEDCOM"
|
msgid "GEDCOM"
|
||||||
@ -394,7 +404,6 @@ def main():
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
namespace, extra = parser.parse_known_args()
|
namespace, extra = parser.parse_known_args()
|
||||||
#print(args, '\n\t\t###\n', vars(args), '\n\t\t###\n', sys.argv[2:])
|
|
||||||
|
|
||||||
if args.test:
|
if args.test:
|
||||||
tests()
|
tests()
|
||||||
@ -415,11 +424,13 @@ def main():
|
|||||||
clean()
|
clean()
|
||||||
|
|
||||||
if args.merge:
|
if args.merge:
|
||||||
|
#retrieve() windows os?
|
||||||
if sys.argv[2:] == ['all']:
|
if sys.argv[2:] == ['all']:
|
||||||
sys.argv[2:] = LANG
|
sys.argv[2:] = LANG
|
||||||
merge(sys.argv[2:])
|
merge(sys.argv[2:])
|
||||||
|
|
||||||
if args.check:
|
if args.check:
|
||||||
|
#retrieve() windows os?
|
||||||
if sys.argv[2:] == ['all']:
|
if sys.argv[2:] == ['all']:
|
||||||
sys.argv[2:] = LANG
|
sys.argv[2:] = LANG
|
||||||
check(sys.argv[2:])
|
check(sys.argv[2:])
|
||||||
|
Loading…
Reference in New Issue
Block a user