Internationalization fixes, support for PDF generation

svn: r45
This commit is contained in:
Don Allingham 2001-05-22 22:30:13 +00:00
parent 883475a8ea
commit 8d0e3136ab
30 changed files with 454 additions and 199 deletions

View File

@ -35,7 +35,6 @@ class Date:
formatCode = 0
entryCode = 0
BadFormat = _("Unknown Format")
Error = _("Illegal Date")
range = 1
@ -231,7 +230,7 @@ class SingleDate:
_("before") + '|' + \
_("after") + '|' + \
_("aft") + '|' + \
_("bef") + ")"
_("bef") + ')'
start = "^\s*" + modifiers + "?\s*"

View File

@ -1905,7 +1905,7 @@
<widget>
<class>GtkLabel</class>
<name>label142</name>
<label>Country :</label>
<label>Country :</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>

View File

@ -734,12 +734,7 @@ def on_event_add_clicked(obj):
desc = edit_person_obj.event_descr_field.get_text()
event = Event()
try:
event.set(name,date,place,desc)
except Date.BadFormat,msg:
msg1 = _(" is not a valid date format, and has been\n")
msg2 = _("ignored as the date of the event.")
GnomeWarningDialog(str(msg) + msg1)
event.set(name,date,place,desc)
if name not in const.personalEvents:
const.personalEvents.append(name)

View File

@ -87,20 +87,22 @@ class HtmlDoc(TextDoc):
self.bottom.append(line)
templateFile.close()
if top_add == 1:
mymsg = "Did not file '<!-- START -->' marker in the template"
mymsg = _("The marker '<!-- START -->' was not in the template")
gnome.ui.GnomeErrorDialog(mymsg)
except IOError,msg:
import gnome.ui
mymsg = "Could not open the template file\n" + str(msg) + "\n" +\
"Using default template"
mymsg = _("Could not open %s\nUsing the default template") % \
self.template
mymsg = "%s\n%s" % (mymsg,msg)
gnome.ui.GnomeWarningDialog(mymsg)
self.bottom = _bottom
self.top = _top
except:
import gnome.ui
mymsg = "Could not open the template file\n" + "Using default template"
mymsg = _("Could not open %s\nUsing the default template") % \
self.template
gnome.ui.GnomeWarningDialog(mymsg)
self.bottom = _bottom
self.top = _top
@ -196,7 +198,7 @@ class HtmlDoc(TextDoc):
def start_cell(self,style_name,span=1):
self.empty = 1
self.f.write('<td')
self.f.write('<td valign="top"')
if span > 1:
self.f.write(' colspan="' + str(span) + '"')
else:
@ -223,6 +225,6 @@ class HtmlDoc(TextDoc):
def write_text(self,text):
if text != "":
self.empty = 0
text = string.replace(text,'\n','<br>>')
text = string.replace(text,'\n','<br>')
self.f.write(text)

View File

@ -34,6 +34,8 @@ import intl
_ = intl.gettext
names = {}
#-------------------------------------------------------------------------
#
#
@ -87,9 +89,14 @@ class ReportPlugins:
item_hash = {}
for report in reports:
info = string.split(report.__doc__,"/")
if report.__dict__.has_key("get_name"):
doc = report.get_name()
else:
doc = report.__doc__
info = string.split(doc,"/")
if len(info) == 1:
category = "Uncategorized"
category = _("Uncategorized")
name = info[0]
else:
category = info[0]
@ -105,7 +112,7 @@ class ReportPlugins:
item.set_data("i",report.get_xpm_image)
else:
item.set_data("i",no_image)
item.set_data("t",report.__doc__)
item.set_data("t",doc)
item.connect("select",on_report_node_selected)
if item_hash.has_key(category):
item_hash[category].append(item)
@ -151,12 +158,17 @@ class ToolPlugins:
item_hash = {}
for report in tools:
info = string.split(report.__doc__,"/")
if report.__dict__.has_key("get_name"):
doc = report.get_name()
else:
doc = report.__doc__
info = string.split(doc,"/")
item = GtkTreeItem(info[1])
item.set_data("o",self)
item.set_data("c",report.runTool)
item.set_data("d",report.get_description)
item.set_data("t",report.__doc__)
item.set_data("t",doc)
item.connect("select",on_node_selected)
if item_hash.has_key(info[0]):
item_hash[info[0]].append(item)
@ -221,7 +233,7 @@ def on_report_node_selected(obj):
#
#-------------------------------------------------------------------------
def by_doc(a,b):
return cmp(a.__doc__,b.__doc__)
return cmp(names[a],names[b])
#-------------------------------------------------------------------------
#
@ -281,8 +293,14 @@ def load_plugins(dir):
groups = match.groups()
try:
plugin = __import__(groups[0])
try:
names[plugin] = plugin.get_name()
except:
names[plugin] = plugin.__doc__
except:
print groups[0]
print _("Failed to load the module: %s") % groups[0]
import traceback
traceback.print_exc()
continue
for task in plugin.__dict__.keys():
if task == "report":
@ -308,7 +326,12 @@ def export_menu(callback):
myMenu = GtkMenu()
for report in exports:
item = GtkMenuItem(report.__doc__)
try:
text = report.get_name()
except:
text = report.__doc__
item = GtkMenuItem(text)
item.show()
item.connect("activate", callback ,report.writeData)
myMenu.append(item)
@ -323,7 +346,12 @@ def import_menu(callback):
myMenu = GtkMenu()
for report in imports:
item = GtkMenuItem(report.__doc__)
try:
text = report.get_name()
except:
text = report.__doc__
item = GtkMenuItem(text)
item.show()
item.connect("activate", callback ,report.readData)
myMenu.append(item)

View File

@ -101,10 +101,10 @@ def loadData(database, filename, callback):
else:
xml_file = EncodedFile(gzip.open(filename,"rb"),'utf-8','latin-1')
except IOError,msg:
GnomeErrorDialog(filename + _(" could not be opened\n") + str(msg))
GnomeErrorDialog(_("%s could not be opened\n") % filename + str(msg))
return 0
except:
GnomeErrorDialog(filename + _(" could not be opened\n"))
GnomeErrorDialog(_("%s could not be opened\n") % filename)
return 0
try:
@ -113,14 +113,13 @@ def loadData(database, filename, callback):
else:
parser.parse(xml_file)
except xml.sax.SAXParseException:
GnomeErrorDialog(filename + _(" is a corrupt file"))
GnomeErrorDialog(_("%s is a corrupt file") % filename)
return 0
except IOError,msg:
GnomeErrorDialog(filename + _(" is not a valid gramps file\n") + \
str(msg))
GnomeErrorDialog(_("Error reading %s") % filename + "\n" + str(msg))
return 0
except:
GnomeErrorDialog(_("Could not read ") + filename)
GnomeErrorDialog(_("Error reading %s") % filename)
return 0

View File

@ -1,9 +1,10 @@
#! /bin/sh
rm -f glade.c
mv template.po template.po.bak
echo "Working on the glade files"
libglade-xgettext -c -o glade.c *.glade
libglade-xgettext -c -o glade.c *.glade plugins/*.glade
echo "Working on python files"
./get_strings *.py filters/*.py >> glade.c
./get_strings *.py plugins/*.py filters/*.py >> glade.c
echo "Building template.po"
xgettext -C -s -a -o template.po glade.c

View File

@ -1,9 +1,11 @@
#! /usr/bin/python -O
import traceback
import intl
import os
intl.textdomain("gramps")
_ = intl.gettext
if os.environ.has_key("GRAMPSI18N"):
locale = os.environ["GRAMPSI18N"]
@ -15,7 +17,20 @@ intl.bindtextdomain("gramps",locale)
import gramps_main
import sys
if len(sys.argv) > 1:
gramps_main.main(sys.argv[1])
else:
gramps_main.main(None)
try:
if len(sys.argv) > 1:
gramps_main.main(sys.argv[1])
else:
gramps_main.main(None)
except:
fname = os.path.expanduser("~/gramps.err")
errfile = open(fname,"w")
traceback.print_exc(file=errfile)
errfile.close()
import gnome.ui
msg1 = _("gramps has encountered an internal error.")
msg2 = _("The error log has been saved to %s.") % fname
gnome.ui.GnomeWarningDialog("%s\n%s" % (msg1,msg2))

View File

@ -640,26 +640,19 @@ def read_file(filename):
if base == const.indexFile:
filename = os.path.dirname(filename)
elif not os.path.isdir(filename):
displayError(filename + _(" is not a directory"))
displayError(_("%s is not a directory") % filename)
return
statusbar.set_status(_("Loading ") +\
filename + "...")
statusbar.set_status(_("Loading %s ...") % filename)
if load_database(filename) == 1:
topWindow.set_title("Gramps - " + filename)
else:
statusbar.set_status("")
Config.save_last_file("")
# try:
# if load_database(filename) == 1:
# topWindow.set_title("Gramps - " + filename)
# else:
# statusbar.set_status("")
# Config.save_last_file("")
# except:
# displayError(_("Failure reading ") + filename)
try:
if load_database(filename) == 1:
topWindow.set_title("%s - %s" % (_("Gramps"),filename))
else:
statusbar.set_status("")
Config.save_last_file("")
except:
displayError(_("Failure reading %s") % filename)
statusbar.set_progress(0.0)
@ -683,31 +676,27 @@ def on_ok_button2_clicked(obj):
#-------------------------------------------------------------------------
def save_file(filename):
import WriteXML
filename = os.path.normpath(filename)
if sbar_active:
statusbar.set_status(_("Saving ") \
+ filename + "...")
statusbar.set_status(_("Saving %s ...") % filename)
if os.path.exists(filename):
if os.path.isdir(filename) == 0:
displayError(filename + _(" is not a directory"))
displayError(_("%s is not a directory") % filename)
return
else:
try:
os.mkdir(filename)
except IOError, msg:
GnomeErrorDialog(_("Could not create ") + \
os.path.normpath(filename) +\
"\n" + str(msg))
GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg))
return
except OSError, msg:
GnomeErrorDialog(_("Could not create ") + \
os.path.normpath(filename) +\
"\n" + str(msg))
GnomeErrorDialog(_("Could not create %s") % filename + "\n" + str(msg))
return
except:
GnomeErrorDialog(_("Could not create ") + \
os.path.normpath(filename))
GnomeErrorDialog(_("Could not create %s") % filename)
return
old_file = filename
@ -1906,8 +1895,8 @@ def on_edit_bookmarks_activate(obj):
def on_default_person_activate(obj):
if active_person:
name = active_person.getPrimaryName().getRegularName()
topWindow.question(_("Do you wish to set ") + name + \
_(" as the home person?"), set_person)
topWindow.question(_("Do you wish to set %s as the home person") % name, \
set_person)
#-------------------------------------------------------------------------
#

View File

@ -31,6 +31,11 @@ import utils
from TextDoc import *
from DrawDoc import *
from OpenDrawDoc import *
try:
from PdfDrawDoc import *
no_pdf = 0
except:
no_pdf = 1
from gtk import *
from gnome.ui import *
@ -162,6 +167,7 @@ class AncestorChart:
name = name + "\nd. " + death.getDate()
self.doc.draw_box("box",name,self.x[level],self.y[index-1])
if index > 1:
old_index = int(index/2)-1
x1 = self.x[level-1]+(self.width/2.0)
@ -170,6 +176,7 @@ class AncestorChart:
y1 = self.y[old_index]+self.height
else:
y1 = self.y[old_index]
y2 = self.y[index-1]+(self.height/2.0)
self.doc.draw_line("line",x1,y1,x1,y2)
self.doc.draw_line("line",x1,y2,x2,y2)
@ -201,6 +208,9 @@ def report(database,person):
PaperMenu.make_paper_menu(topDialog.get_widget("papersize"))
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
if no_pdf == 1:
topDialog.get_widget("pdf").set_sensitive(0)
title = _("Ancestor chart for %s") % name
topDialog.get_widget("labelTitle").set_text(title)
topDialog.signal_autoconnect({
@ -228,9 +238,12 @@ def on_save_clicked(obj):
max_gen = topDialog.get_widget("generations").get_value_as_int()
document = OpenDrawDoc(paper,orien)
if topDialog.get_widget("openoffice").get_active():
document = OpenDrawDoc(paper,orien)
else:
document = PdfDrawDoc(paper,orien)
MyReport = AncestorChart(db,active_person,outputName,document, max_gen)
MyReport = AncestorChart(db,active_person,outputName,document,max_gen)
MyReport.setup()
MyReport.write_report()

View File

@ -36,6 +36,12 @@ from OpenOfficeDoc import *
from HtmlDoc import *
from AbiWordDoc import *
try:
from PdfDoc import *
no_pdf = 0
except:
no_pdf = 1
from gtk import *
from gnome.ui import *
from libglade import *
@ -129,7 +135,7 @@ class AncestorReport:
try:
self.doc.open(output)
except IOError,msg:
GnomeErrorDialog(_("Could not open %s\n%s"),msg)
GnomeErrorDialog(_("Could not open %s") % output + "\n" + msg)
#--------------------------------------------------------------------
#
@ -320,6 +326,9 @@ def report(database,person):
PaperMenu.make_paper_menu(topDialog.get_widget("papersize"))
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
if no_pdf:
topDialog.get_widget("pdf").set_sensitive(0)
topDialog.get_widget("labelTitle").set_text("Ahnentafel Report for " + name)
topDialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
@ -368,6 +377,8 @@ def on_save_clicked(obj):
document = OpenOfficeDoc(paper,orien)
elif topDialog.get_widget("abiword").get_active():
document = AbiWordDoc(paper,orien)
elif topDialog.get_widget("pdf").get_active():
document = PdfDoc(paper,orien)
else:
document = HtmlDoc(template)

View File

@ -25,6 +25,9 @@ import re
import string
import os
import utils
import intl
_ = intl.gettext
from gtk import *
from gnome.ui import *
@ -75,12 +78,20 @@ def add_to_tree(tree,person):
subtree.show()
item.set_subtree(subtree)
add_to_tree(subtree,child)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def get_name():
return _("Analysis and Exploration/Interactive descendant browser")
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def get_description():
return "Provides a browsable hierarchy of the active person"
return _("Provides a browsable hierarchy of the active person")

View File

@ -24,6 +24,9 @@ import os
import re
import sort
import string
import intl
_ = intl.gettext
import RelLib
import const
@ -33,6 +36,12 @@ from TextDoc import *
from OpenOfficeDoc import *
from AbiWordDoc import *
from HtmlDoc import *
try:
import reportlab.platypus.tables
from PdfDoc import *
no_pdf = 0
except:
no_pdf = 1
from gtk import *
from gnome.ui import *
@ -96,8 +105,9 @@ class DescendantReport:
#--------------------------------------------------------------------
def report(self):
self.doc.start_paragraph("Title")
self.doc.write_text('Descendants of ')
self.doc.write_text(self.person.getPrimaryName().getRegularName())
name = self.person.getPrimaryName().getRegularName()
self.doc.write_text(_("Descendants of %s") % name)
self.doc.write_text()
self.doc.end_paragraph()
self.dump(1,self.person)
@ -151,6 +161,10 @@ class DesReportWindow:
PaperMenu.make_orientation_menu(self.top.get_widget("orientation"))
mytop = self.top.get_widget("dialog1")
if no_pdf:
self.top.get_widget("pdf").set_sensitive(0)
mytop.set_data("o",self)
mytop.set_data("d",db)
mytop.show()
@ -187,7 +201,7 @@ def on_save_clicked(obj):
elif myobj.top.get_widget("abiword").get_active():
document = AbiWordDoc(paper,orien)
else:
return
document = PdfDoc(paper,orien)
report = DescendantReport(file,myobj.person,db,document)
report.setup()
@ -218,8 +232,11 @@ def on_html_toggled(obj):
#
#------------------------------------------------------------------------
def get_description():
return "Generates a list of descendants of the active person"
return _("Generates a list of descendants of the active person")
def get_name():
return _("Generate files/Descendant Report")
#------------------------------------------------------------------------
#
#

View File

@ -30,6 +30,9 @@ import re
import sort
import utils
import string
import intl
_ = intl.gettext
#------------------------------------------------------------------------
#
@ -450,10 +453,10 @@ def runTool(database,person,callback):
#
#-------------------------------------------------------------------------
def get_description():
return "Genealogical Research Event Analysis Tool\n\n" \
"Aids in the analysis of data by allowing the development "\
"of custom filters that can be applied to the database to "\
"find similar events"
return _("Aids in the analysis of data by allowing the development of custom filters that can be applied to the database to find similar events")
def get_name():
return _("Analysis and Exploration/Compare individual events")
#-------------------------------------------------------------------------
#

View File

@ -27,10 +27,19 @@ import re
import sort
import string
import utils
import intl
_ = intl.gettext
from TextDoc import *
from OpenOfficeDoc import *
from HtmlDoc import *
try:
import reportlab.platypus.tables
from PdfDoc import *
no_pdf = 0
except:
no_pdf = 1
from gtk import *
from gnome.ui import *
@ -157,7 +166,7 @@ class FamilyGroup:
def setup(self):
self.doc.open(self.output)
self.doc.start_paragraph('Title')
self.doc.write_text("Family Group Record")
self.doc.write_text(_("Family Group Record"))
self.doc.end_paragraph()
def end(self):
@ -186,7 +195,7 @@ class FamilyGroup:
self.doc.start_row()
self.doc.start_cell("TextContents")
self.doc.start_paragraph('Normal')
self.doc.write_text("Birth")
self.doc.write_text(_("Birth"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell("TextContents")
@ -204,7 +213,7 @@ class FamilyGroup:
self.doc.start_row()
self.doc.start_cell("TextContents")
self.doc.start_paragraph('Normal')
self.doc.write_text("Death")
self.doc.write_text(_("Death"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell("TextContents")
@ -232,7 +241,7 @@ class FamilyGroup:
self.doc.start_row()
self.doc.start_cell("TextContents")
self.doc.start_paragraph('Normal')
self.doc.write_text("Father")
self.doc.write_text(_("Father"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell("TextContentsEnd",2)
@ -245,7 +254,7 @@ class FamilyGroup:
self.doc.start_row()
self.doc.start_cell("TextContents")
self.doc.start_paragraph('Normal')
self.doc.write_text("Mother")
self.doc.write_text(_("Mother"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell("TextContentsEnd",2)
@ -258,6 +267,12 @@ class FamilyGroup:
self.doc.end_table()
def dump_child_event(self,text,name,event):
if event:
date = event.getDate()
place = event.getPlace()
else:
date = ""
place = ""
self.doc.start_row()
self.doc.start_cell(text)
self.doc.start_paragraph('Normal')
@ -270,12 +285,12 @@ class FamilyGroup:
self.doc.end_cell()
self.doc.start_cell('TextContents')
self.doc.start_paragraph('Normal')
self.doc.write_text(event.getDate())
self.doc.write_text(date)
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('TextContentsEnd')
self.doc.start_paragraph('Normal')
self.doc.write_text(event.getPlace())
self.doc.write_text(place)
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.end_row()
@ -307,6 +322,7 @@ class FamilyGroup:
index = 1
for family in person.getFamilyList():
m = family.getMarriage()
if person == family.getFather():
spouse =family.getMother()
else:
@ -318,7 +334,7 @@ class FamilyGroup:
self.doc.end_cell()
self.doc.start_cell('TextContents')
self.doc.start_paragraph('Normal')
self.doc.write_text("Spouse")
self.doc.write_text(_("Spouse"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.start_cell('TextContentsEnd',2)
@ -328,11 +344,10 @@ class FamilyGroup:
self.doc.end_cell()
self.doc.end_row()
m = family.getMarriage()
if index == families:
self.dump_child_event('TextChild2','Married',m)
self.dump_child_event('TextChild2',_("Married"),m)
else:
self.dump_child_event('TextChild1','Death',m)
self.dump_child_event('TextChild1',_("Married"),m)
#--------------------------------------------------------------------
#
@ -353,7 +368,7 @@ class FamilyGroup:
self.doc.start_row()
self.doc.start_cell('ParentHead',4)
self.doc.start_paragraph('ParentName')
self.doc.write_text('Children')
self.doc.write_text(_("Children"))
self.doc.end_paragraph()
self.doc.end_cell()
self.doc.end_row()
@ -388,7 +403,10 @@ def report(database,person):
family_list = person.getFamilyList()
label = topDialog.get_widget("labelTitle")
label.set_text("Family Group chart for " + name)
if no_pdf == 1:
topDialog.get_widget("pdf").set_sensitive(0)
label.set_text(_("Family Group chart for %s") % name)
topDialog.signal_autoconnect({
"destroy_passed_object" : utils.destroy_passed_object,
"on_save_clicked" : on_save_clicked,
@ -400,7 +418,7 @@ def report(database,person):
frame = topDialog.get_widget("spouse")
option_menu = topDialog.get_widget("spouse_menu")
if len(family_list) > 1:
frame.show()
else:
@ -449,8 +467,10 @@ def on_save_clicked(obj):
if topDialog.get_widget("html").get_active():
template = topDialog.get_widget("htmlfile").get_text()
doc = HtmlDoc(template)
else:
elif topDialog.get_widget("openoffice").get_active():
doc = OpenOfficeDoc(paper,orien)
else:
doc = PdfDoc(paper,orien)
MyReport = FamilyGroup(db,family,outputName,doc)
@ -465,9 +485,10 @@ def on_save_clicked(obj):
#
#------------------------------------------------------------------------
def get_description():
return "Creates a family group report, showing information on "\
"a set of parents and their children."
return _("Creates a family group report, showing information on a set of parents and their children.")
def get_name():
return _("Generate files/Family Group Report")

View File

@ -26,6 +26,9 @@ import re
import sort
import string
import utils
import intl
_ = intl.gettext
from gtk import *
from gnome.ui import *
@ -238,10 +241,11 @@ def dump_index(person_list,file):
#
#------------------------------------------------------------------------
def get_description():
return "Generates relationship graphs, currently only in GraphVis " \
"format. GraphViz (dot) will transform the graph into "\
"postscript, jpeg, png, vrml, svg, and many other formats. "\
"GraphViz is a research project from former AT&T Research Labs. "\
"For more information or to get a copy of GraphViz, goto "\
"http://www.graphviz.org"
return _("Generates relationship graphs, currently only in GraphVis format.") + \
" " + \
_("GraphViz (dot) will transform the graph into postscript, jpeg, png, vrml, svg, and many other formats.") + \
" " + \
_("For more information or to get a copy of GraphViz, goto http://www.graphviz.org")
def get_name():
return _("Generate files/Relationship graph")

View File

@ -23,6 +23,8 @@
from RelLib import *
import const
import utils
import intl
_ = intl.gettext
import os
import re
@ -144,12 +146,12 @@ def an_des_of_gparents_filter(database,person,list):
#------------------------------------------------------------------------
filter_map = {
"Individual" : individual_filter,
"Ancestors" : ancestor_filter,
"Descendants" : descendant_filter,
"Ancestors and descendants" : an_des_filter,
"Grandparent's ancestors and descendants" : an_des_of_gparents_filter,
"Entire database" : entire_db_filter
_("Individual") : individual_filter,
_("Ancestors") : ancestor_filter,
_("Descendants") : descendant_filter,
_("Ancestors and descendants") : an_des_filter,
_("Grandparent's ancestors and descendants") : an_des_of_gparents_filter,
_("Entire database") : entire_db_filter
}
#-------------------------------------------------------------------------
@ -261,19 +263,19 @@ def on_ok_clicked(obj):
elif not os.path.isdir(directoryName):
parent_dir = os.path.dirname(directoryName)
if not os.path.isdir(parent_dir):
GnomeErrorDialog("Neither " + directoryName + " nor " + \
parent_dir + " are directories")
GnomeErrorDialog(_("Neither %s nor %s are directories") % \
(directoryName,parent_dir))
return
else:
try:
print "trying to make",directoryName
os.mkdir(directoryName)
except IOError, value:
GnomeErrorDialog("Could not create the directory " + directoryName + "\n" + \
value[1])
GnomeErrorDialog(_("Could not create the directory : %s") % \
directoryName + "\n" + value[1])
return
except:
GnomeErrorDialog("Could not create the directory " + directoryName)
GnomeErrorDialog(_("Could not create the directory : %s") % \
directoryName)
return
if templateName == None:
@ -282,11 +284,11 @@ def on_ok_clicked(obj):
try:
templateFile = open(templateName,"r")
except IOError, value:
GnomeErrorDialog("Could not open the template file (" + templateName + ")\n" + \
value[1])
GnomeErrorDialog(_("Could not open the template file (%s)") % templateName + \
"\n" + value[1])
return
except:
GnomeErrorDialog("Could not open the template file (" + templateName + ")")
GnomeErrorDialog(_("Could not open the template file (%s)") % templateName)
return
top_add = 1
@ -351,9 +353,9 @@ def print_event(html,name,event):
html.write("<H2>%s</H2>\n" % name)
html.write("<UL>\n")
if date != "":
html.write("<LI>Date : %s</LI>\n" % date)
html.write("<LI>%s : %s</LI>\n" % (_("Date"),date))
if place != "":
html.write("<LI>Place : %s</LI>\n" % place)
html.write("<LI>%s : %s</LI>\n" % (_("Place"),place))
html.write("</UL>\n")
#------------------------------------------------------------------------
@ -401,7 +403,8 @@ def dump_person(person,prefix,templateTop,templateBottom,targetDir):
regex_match = titleRe.search(line)
if regex_match != None:
html.write("Family Tree - %s\n" % name )
txt = _("Family Tree")
html.write("%s - %s\n" % (txt,name) )
html.write("<H1>%s</H1>\n" % person.getPrimaryName().getRegularName())
@ -424,12 +427,12 @@ def dump_person(person,prefix,templateTop,templateBottom,targetDir):
html.write('" WIDTH="' + str(width) + '" HEIGHT="200">\n')
if not alive:
print_event(html,"Birth",person.getBirth())
print_event(html,"Death",person.getDeath())
print_event(html,_("Birth"),person.getBirth())
print_event(html,_("Death"),person.getDeath())
family = person.getMainFamily()
if family != None:
html.write("<H2>Parents</H2>\n")
html.write("<H2>%s</H2>\n" % _("Parents"))
html.write("<UL>\n")
write_reference(html,family.getFather(), prefix)
write_reference(html,family.getMother(), prefix)
@ -438,7 +441,7 @@ def dump_person(person,prefix,templateTop,templateBottom,targetDir):
for family in person.getFamilyList():
html.write("<H2>Spouse</H2>\n")
html.write("<H2>%s</H2>\n" % _("Spouse"))
html.write("<UL>\n")
if person.getGender() == Person.male:
spouse = family.getMother()
@ -453,7 +456,8 @@ def dump_person(person,prefix,templateTop,templateBottom,targetDir):
spouse_alive = probably_alive(spouse)
if name == None or name.getRegularName() == "":
html.write("<LI>Spouse's name is not known</LI>\n")
txt = _("Spouse's name is not known")
html.write("<LI>%s</LI>\n" % txt)
else:
write_reference(html,spouse,prefix)
@ -461,12 +465,12 @@ def dump_person(person,prefix,templateTop,templateBottom,targetDir):
if marriage and not alive and not spouse_alive:
place = marriage.getPlace()
date = marriage.getDate()
if place != "" and date != "":
html.write("<LI>Married %s, %s</LI>\n" % (date, place))
elif place == "":
html.write("<LI>Marriage place :%s</LI>\n" % place)
else:
html.write("<LI>Marriage date :%s</LI>\n" % date)
if place:
txt = _("Marriage place")
html.write("<LI>%s :%s</LI>\n" % (txt,place))
if date:
txt = _("Marriage date")
html.write("<LI>%s :%s</LI>\n" % (txt,date))
if spouse:
sp_family = spouse.getMainFamily()
@ -474,23 +478,24 @@ def dump_person(person,prefix,templateTop,templateBottom,targetDir):
sp_father = sp_family.getFather()
sp_mother = sp_family.getMother()
if sp_father and sp_mother:
html.write("<LI>Spouse's parents: ")
html.write(name_or_link(sp_father,prefix))
html.write(" and ")
html.write(name_or_link(sp_mother,prefix))
html.write("</LI>\n")
txt = _("Spouse's parents: %s and %s") % \
(name_or_link(sp_father,prefix),\
name_or_link(sp_mother,prefix))
html.write("<LI>%s</LI>\n" % txt)
elif sp_father:
html.write("<LI>Spouse's father: %s</LI>\n" %
name_or_link(sp_father,prefix))
txt = _("Spouse's father: %s and %s") % \
name_or_link(sp_father,prefix)
html.write("<LI>%s</LI>\n" % txt)
elif sp_mother:
html.write("<LI>Spouse's mother: %s</LI>\n" %
name_or_link(sp_mother,prefix))
txt = _("Spouse's father: %s and %s") % \
name_or_link(sp_mother,prefix)
html.write("<LI>%s</LI>\n" % txt)
html.write("</UL>\n")
childList = family.getChildList()
if len(childList) > 0:
html.write("<H3>Children</H3>\n")
html.write("<H3>%s</H3>\n" % _("Children"))
html.write("<UL>\n")
for child in childList:
write_reference(html,child,prefix)
@ -499,7 +504,7 @@ def dump_person(person,prefix,templateTop,templateBottom,targetDir):
note = person.getNote()
if note != "":
html.write("<H2>Notes</H2>\n")
html.write("<H2>%s</H2>\n" % _("Notes"))
noteList = string.split(note,"\n")
for text in noteList:
html.write("<P>" + text + "</P>\n")
@ -524,9 +529,9 @@ def dump_index(person_list,filename,prefix,templateTop,templateBottom,targetDir)
regex_match = titleRe.search(line)
if regex_match != None:
html.write("Family Tree - Index\n")
html.write("%s\n" % _("Family Tree - Index"))
html.write("<H1>Family Tree Index</H1>\n")
html.write("<H1>%s</H1>\n" % _("Family Tree Index"))
person_list.sort(sort.by_last_name)
for person in person_list:
@ -544,6 +549,7 @@ def dump_index(person_list,filename,prefix,templateTop,templateBottom,targetDir)
#
#------------------------------------------------------------------------
def get_description():
return "Generates web (HTML) pages for individuals, or a set of " \
"individuals."
return _("Generates web (HTML) pages for individuals, or a set of individuals.")
def get_name():
return _("Generate files/Individual web pages")

View File

@ -35,6 +35,12 @@ from TextDoc import *
from OpenOfficeDoc import *
from HtmlDoc import *
from AbiWordDoc import *
try:
import reportlab.platypus.tables
from PdfDoc import *
no_pdf = 0
except:
no_pdf = 1
from gtk import *
from gnome.ui import *
@ -183,7 +189,7 @@ class IndivSummary:
self.d.start_row()
self.d.start_cell("TableHead",2)
self.d.start_paragraph("TableTitle")
self.d.write_text("Marriages/Children")
self.d.write_text(_("Marriages/Children"))
self.d.end_paragraph()
self.d.end_cell()
self.d.end_row()
@ -211,7 +217,7 @@ class IndivSummary:
self.d.start_row()
self.d.start_cell("NormalCell")
self.d.start_paragraph("Normal")
self.d.write_text("Children")
self.d.write_text(_("Children"))
self.d.end_paragraph()
self.d.end_cell()
@ -237,10 +243,10 @@ class IndivSummary:
#--------------------------------------------------------------------
def write_report(self):
photo_list = self.person.getPhotoList()
name = self.person.getPrimaryName().getRegularName()
self.d.start_paragraph("Title")
self.d.write_text('Summary of ')
self.d.write_text(self.person.getPrimaryName().getRegularName())
self.d.write_text(_("Summary of %s") % name)
self.d.end_paragraph()
self.d.start_paragraph("Normal")
@ -257,7 +263,7 @@ class IndivSummary:
self.d.start_row()
self.d.start_cell("NormalCell")
self.d.start_paragraph("Normal")
self.d.write_text("Name:")
self.d.write_text("%s:" % _("Name"))
self.d.end_paragraph()
self.d.end_cell()
@ -271,16 +277,16 @@ class IndivSummary:
self.d.start_row()
self.d.start_cell("NormalCell")
self.d.start_paragraph("Normal")
self.d.write_text("Gender:")
self.d.write_text("%s:" % _("Gender"))
self.d.end_paragraph()
self.d.end_cell()
self.d.start_cell("NormalCell")
self.d.start_paragraph("Normal")
if self.person.getGender() == RelLib.Person.male:
self.d.write_text("Male")
self.d.write_text(_("Male"))
else:
self.d.write_text("Female")
self.d.write_text(_("Female"))
self.d.end_paragraph()
self.d.end_cell()
self.d.end_row()
@ -296,7 +302,7 @@ class IndivSummary:
self.d.start_row()
self.d.start_cell("NormalCell")
self.d.start_paragraph("Normal")
self.d.write_text("Father:")
self.d.write_text("%s:" % _("Father"))
self.d.end_paragraph()
self.d.end_cell()
@ -310,7 +316,7 @@ class IndivSummary:
self.d.start_row()
self.d.start_cell("NormalCell")
self.d.start_paragraph("Normal")
self.d.write_text("Mother:")
self.d.write_text("%s:" % _("Mother"))
self.d.end_paragraph()
self.d.end_cell()
@ -329,7 +335,7 @@ class IndivSummary:
self.d.start_row()
self.d.start_cell("TableHead",2)
self.d.start_paragraph("TableTitle")
self.d.write_text("Individual Facts")
self.d.write_text(_("Individual Facts"))
self.d.end_paragraph()
self.d.end_cell()
self.d.end_row()
@ -367,6 +373,8 @@ def report(database,person):
label = topDialog.get_widget("labelTitle")
label.set_text("Individual Summary for " + name)
if no_pdf:
topDialog.get_widget("pdf").set_sensitive(0)
PaperMenu.make_paper_menu(topDialog.get_widget("papersize"))
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
@ -406,6 +414,8 @@ def on_save_clicked(obj):
if topDialog.get_widget("html").get_active():
template = topDialog.get_widget("htmlfile").get_text()
doc = HtmlDoc(template)
elif topDialog.get_widget("pdf").get_active():
doc = PdfDoc(paper,orien)
else:
doc = OpenOfficeDoc(paper,orien)
@ -422,9 +432,10 @@ def on_save_clicked(obj):
#
#------------------------------------------------------------------------
def get_description():
return _("Creates a family group report, showing information on ") +\
_("a set of parents and their children.")
return _("Creates a family group report, showing information on a set of parents and their children.")
def get_name():
return _("Generate files/Individual Summary")

View File

@ -24,6 +24,8 @@ import RelLib
import utils
import soundex
import Check
import intl
_ = intl.gettext
import string
import os
@ -537,8 +539,9 @@ class Merge:
else:
mother2 = ""
label1 = "First Person (" + str(person1.getId()) + ")"
label2 = "Second Person (" + str(person2.getId()) + ")"
label1 = "%s (%s)" % (_("First Person"),str(person1.getId()))
label2 = "%s (%s)" % (_("Second Person"),str(person2.getId()))
self.topDialog.get_widget("PersonFrame1").set_label(label1)
self.topDialog.get_widget("PersonFrame2").set_label(label2)
self.topDialog.get_widget("name1_text").set_text(name1)
@ -933,8 +936,10 @@ def runTool(database,active_person,callback):
#
#-------------------------------------------------------------------------
def get_description():
return "Searches the entire database, looking for individual "\
"entries that may represent the same person"
return _("Searches the entire database, looking for individual entries that may represent the same person")
def get_name():
return _("Database Processing/Merge people")
#-------------------------------------------------------------------------
#

View File

@ -22,6 +22,8 @@
import os
import re
import intl
_ = intl.gettext
from gnome.ui import *
@ -62,15 +64,14 @@ def runTool(database,active_person,callback):
nick_count = nick_count + 1
if nick_count == 1:
msg = "1 nickname was extracted\n"
msg = _("1 nickname was extracted")
else:
msg = "%d nicknames were extracted\n" % nick_count
msg = _("%d nicknames were extracted\n") % nick_count
if title_count == 1:
msg = msg + "1 title was extracted"
msg = msg + "\n" + _("1 title was extracted")
else:
msg = msg + "%d titles were extracted" % title_count
msg = msg + "\n" + _("%d titles were extracted") % title_count
if nick_count > 0 or title_count > 0:
utils.modified()
@ -85,9 +86,10 @@ def runTool(database,active_person,callback):
#
#-------------------------------------------------------------------------
def get_description():
return "Searches the entire database and attempts to extract titles "\
"and nicknames that may be embedded in a person's given name field."
return _("Searches the entire database and attempts to extract titles and nicknames that may be embedded in a person's given name field.")
def get_name():
return _("Database Processing/Extract information from names")

View File

@ -23,6 +23,8 @@
from RelLib import *
import latin_ansel
import latin_utf8
import intl
_ = intl.gettext
import os
import re
@ -641,13 +643,12 @@ def on_ok_clicked(obj):
try:
importData(db,name)
except InvalidGedcom:
GnomeErrorDialog(name + " is not a valid GEDCOM file")
GnomeErrorDialog(_("%s is not a valid GEDCOM file") % name)
statusWindow.destroy()
except IOError, val:
GnomeErrorDialog("Could not load " + name + "\n" + val[1])
GnomeErrorDialog(_("Could not load %s") % name + "\n" + val[1])
except:
GnomeErrorDialog("Could not load " + name + \
"\n due to an unexpected internal error")
GnomeErrorDialog(_("Could not load %s") % name)
statusWindow.destroy()
#-------------------------------------------------------------------------
@ -676,3 +677,10 @@ def readData(database,active_person,cb):
topDialog.signal_autoconnect(dic)
topDialog.get_widget("gedcomImport").show()
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def get_name():
return _("Import from GEDCOM")

View File

@ -23,6 +23,9 @@
import libglade
from ReadXML import *
import utils
import intl
_ = intl.gettext
#-------------------------------------------------------------------------
#
@ -78,4 +81,11 @@ def on_ok_clicked(obj):
utils.destroy_passed_object(obj)
importData(db,name,progress)
callback(1)
#-------------------------------------------------------------------------
#
#
#
#-------------------------------------------------------------------------
def get_name():
return _("Import from Gramps")

View File

@ -28,6 +28,9 @@ from libglade import *
import RelLib
import sort
import intl
_ = intl.gettext
topDialog = None
other_person = None
@ -257,6 +260,7 @@ def runTool(database,person,callback):
#
#-------------------------------------------------------------------------
def get_description():
return "Calculates the relationship between two people"
return _("Calculates the relationship between two people")
def get_name():
return _("Utilities/Relationship calculator")

View File

@ -27,6 +27,8 @@ import re
import sort
import string
import utils
import intl
_ = intl.gettext
from gtk import *
from gnome.ui import *
@ -113,5 +115,8 @@ def report(database,person):
#
#-------------------------------------------------------------------------
def get_description():
return "Provides a summary of the current database"
return _("Provides a summary of the current database")
def get_name():
return _("View/Summary of the database")

View File

@ -590,30 +590,30 @@ def writeData(database,person):
filter_obj = topDialog.get_widget("filter")
myMenu = GtkMenu()
menuitem = GtkMenuItem("Entire Database")
menuitem = GtkMenuItem(_("Entire Database"))
myMenu.append(menuitem)
menuitem.set_data("filter",entire_database)
menuitem.show()
menuitem = GtkMenuItem("Ancestors of " + \
active_person.getPrimaryName().getRegularName())
name = active_person.getPrimaryName().getRegularName()
menuitem = GtkMenuItem(_("Ancestors of %s") % name)
myMenu.append(menuitem)
menuitem.set_data("filter",active_person_ancestors)
menuitem.show()
menuitem = GtkMenuItem("Descendants of " + \
active_person.getPrimaryName().getRegularName())
menuitem = GtkMenuItem(_("Descendants of %s") % name)
myMenu.append(menuitem)
menuitem.set_data("filter",active_person_descendants)
menuitem.show()
menuitem = GtkMenuItem("Ancestors and Descendants of " + \
active_person.getPrimaryName().getRegularName())
menuitem = GtkMenuItem(_("Ancestors and Descendants of %s") % name)
myMenu.append(menuitem)
menuitem.set_data("filter",active_person_ancestors_and_descendants)
menuitem.show()
menuitem = GtkMenuItem("People somehow connected to " + \
active_person.getPrimaryName().getRegularName())
menuitem = GtkMenuItem(_("People somehow connected to %s") % name)
myMenu.append(menuitem)
menuitem.set_data("filter",interconnected)
menuitem.show()
filter_obj.set_menu(myMenu)
topDialog.get_widget("gedcomExport").show()
def get_name():
return _("Export to GEDCOM")

View File

@ -209,6 +209,21 @@
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>pdf</name>
<can_focus>True</can_focus>
<label>PDF</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>format</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
</widget>

View File

@ -226,6 +226,21 @@
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>pdf</name>
<can_focus>True</can_focus>
<label>PDF</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>format</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox5</name>

View File

@ -224,6 +224,27 @@
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>pdf</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_html_toggled</handler>
<object>dialog1</object>
<last_modification_time>Tue, 20 Mar 2001 17:02:37 GMT</last_modification_time>
</signal>
<label>PDF</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>format</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>html</name>
@ -384,7 +405,8 @@
<class>GtkOptionMenu</class>
<name>papersize</name>
<can_focus>True</can_focus>
<items></items>
<items>
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
@ -406,7 +428,8 @@
<class>GtkOptionMenu</class>
<name>orientation</name>
<can_focus>True</can_focus>
<items></items>
<items>
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>

View File

@ -194,7 +194,8 @@
<name>spouse_menu</name>
<border_width>10</border_width>
<can_focus>True</can_focus>
<items></items>
<items>
</items>
<initial_choice>0</initial_choice>
</widget>
</widget>
@ -232,6 +233,26 @@
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>pdf</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_html_toggled</handler>
<last_modification_time>Tue, 20 Mar 2001 17:02:37 GMT</last_modification_time>
</signal>
<label>PDF</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>format</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>html</name>
@ -391,7 +412,8 @@
<class>GtkOptionMenu</class>
<name>orientation</name>
<can_focus>True</can_focus>
<items></items>
<items>
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>
@ -413,7 +435,8 @@
<class>GtkOptionMenu</class>
<name>papersize</name>
<can_focus>True</can_focus>
<items></items>
<items>
</items>
<initial_choice>0</initial_choice>
<child>
<left_attach>1</left_attach>

View File

@ -209,6 +209,26 @@
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>pdf</name>
<can_focus>True</can_focus>
<signal>
<name>toggled</name>
<handler>on_html_toggled</handler>
<last_modification_time>Tue, 20 Mar 2001 17:02:37 GMT</last_modification_time>
</signal>
<label>PDF</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>format</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>html</name>