* src/plugins/ExportCSV.py:
* src/plugins/ImportCSV.py: fix international/translation issues 2008-01-26 Douglas S. Blank <dblank@cs.brynmawr.edu> svn: r9938
This commit is contained in:
		@@ -1,3 +1,8 @@
 | 
				
			|||||||
 | 
					2008-01-26  Douglas S. Blank  <dblank@cs.brynmawr.edu>
 | 
				
			||||||
 | 
						* src/plugins/ExportCSV.py: 
 | 
				
			||||||
 | 
						* src/plugins/ImportCSV.py: 
 | 
				
			||||||
 | 
						fix international/translation issues
 | 
				
			||||||
 | 
					
 | 
				
			||||||
2008-01-26  Douglas S. Blank  <dblank@cs.brynmawr.edu>
 | 
					2008-01-26  Douglas S. Blank  <dblank@cs.brynmawr.edu>
 | 
				
			||||||
	* src/DataViews/PersonView.py (PersonView.write_tabbed_file): 
 | 
						* src/DataViews/PersonView.py (PersonView.write_tabbed_file): 
 | 
				
			||||||
	reverted previous change
 | 
						reverted previous change
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -264,7 +264,8 @@ class CSVWriter:
 | 
				
			|||||||
                    self.plist[p] = 1
 | 
					                    self.plist[p] = 1
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
                try:
 | 
					                try:
 | 
				
			||||||
                    for p in self.option_box.cfilter.apply(self.db, self.db.get_person_handles(sort_handles=False)):
 | 
					                    for p in self.option_box.cfilter.apply(self.db, 
 | 
				
			||||||
 | 
					                                                           self.db.get_person_handles(sort_handles=False)):
 | 
				
			||||||
                        self.plist[p] = 1
 | 
					                        self.plist[p] = 1
 | 
				
			||||||
                except Errors.FilterError, msg:
 | 
					                except Errors.FilterError, msg:
 | 
				
			||||||
                    (m1,m2) = msg.messages()
 | 
					                    (m1,m2) = msg.messages()
 | 
				
			||||||
@@ -362,11 +363,12 @@ class CSVWriter:
 | 
				
			|||||||
        plist = [data[2] for data in sortorder]
 | 
					        plist = [data[2] for data in sortorder]
 | 
				
			||||||
        ###########################
 | 
					        ###########################
 | 
				
			||||||
        if self.include_individuals:
 | 
					        if self.include_individuals:
 | 
				
			||||||
            self.write_csv("Person", "Lastname", "Firstname", "Callname", "Suffix",
 | 
					            self.write_csv(_("Person"), _("Surname"), _("Given"), 
 | 
				
			||||||
                           "Prefix", "Title", "Gender",
 | 
					                           _("Call"), _("Suffix"), _("Prefix"), 
 | 
				
			||||||
                           "Birthdate", "Birthplace", "Birthsource",
 | 
					                           _("Title"), _("Gender"), _("Birth date"), 
 | 
				
			||||||
                           "Deathdate", "Deathplace", "Deathsource",
 | 
					                           _("Birth place"), _("Birth source"),
 | 
				
			||||||
                           "Note")
 | 
					                           _("Death date"), _("Death place"), 
 | 
				
			||||||
 | 
					                           _("Death source"), _("Note"))
 | 
				
			||||||
            for key in plist:
 | 
					            for key in plist:
 | 
				
			||||||
                person = self.db.get_person_from_handle(key)
 | 
					                person = self.db.get_person_from_handle(key)
 | 
				
			||||||
                if person:
 | 
					                if person:
 | 
				
			||||||
@@ -431,8 +433,8 @@ class CSVWriter:
 | 
				
			|||||||
        flist = [data[1] for data in sortorder]
 | 
					        flist = [data[1] for data in sortorder]
 | 
				
			||||||
        ########################### 
 | 
					        ########################### 
 | 
				
			||||||
        if self.include_marriages:
 | 
					        if self.include_marriages:
 | 
				
			||||||
            self.write_csv("Marriage", "Husband", "Wife", "Date", "Place",
 | 
					            self.write_csv(_("Marriage"), _("Husband"), _("Wife"), 
 | 
				
			||||||
                           "Source", "Note")
 | 
					                           _("Date"), _("Place"), _("Source"), _("Note"))
 | 
				
			||||||
            for key in flist:
 | 
					            for key in flist:
 | 
				
			||||||
                family = self.db.get_family_from_handle(key)
 | 
					                family = self.db.get_family_from_handle(key)
 | 
				
			||||||
                if family:
 | 
					                if family:
 | 
				
			||||||
@@ -471,7 +473,7 @@ class CSVWriter:
 | 
				
			|||||||
                self.update()
 | 
					                self.update()
 | 
				
			||||||
            self.writeln()
 | 
					            self.writeln()
 | 
				
			||||||
        if self.include_children:
 | 
					        if self.include_children:
 | 
				
			||||||
            self.write_csv("Family", "Child")
 | 
					            self.write_csv(_("Family"), _("Child"))
 | 
				
			||||||
            for key in flist:
 | 
					            for key in flist:
 | 
				
			||||||
                family = self.db.get_family_from_handle(key)
 | 
					                family = self.db.get_family_from_handle(key)
 | 
				
			||||||
                if family:
 | 
					                if family:
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -153,19 +153,134 @@ def rd(line_number, row, col, key, default = None):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
def cleanup_column_name(column):
 | 
					def cleanup_column_name(column):
 | 
				
			||||||
    """ Handle column aliases """
 | 
					    """ Handle column aliases """
 | 
				
			||||||
    retval = string.lower(column)
 | 
					    if retval in ["Lastname", 
 | 
				
			||||||
    if retval == "lastname":
 | 
					                  "Surname", _("Surname")]:
 | 
				
			||||||
        retval = "surname"
 | 
					        return "surname"
 | 
				
			||||||
    elif retval == "mother":
 | 
					    elif retval in ["Firstname", 
 | 
				
			||||||
        retval = "wife"
 | 
					                    "Given name", _("Given name"), 
 | 
				
			||||||
    elif retval == "father":
 | 
					                    "Given", _("Given")]:
 | 
				
			||||||
        retval = "husband"
 | 
					        return "firstname"
 | 
				
			||||||
    elif retval == "parent1":
 | 
					    elif retval in ["Callname", 
 | 
				
			||||||
        retval = "husband"
 | 
					                    "Call name", _("Call name"),
 | 
				
			||||||
    elif retval == "parent2":
 | 
					                    "Call", _("Call")]:
 | 
				
			||||||
        retval = "wife"
 | 
					        return "callname"
 | 
				
			||||||
    elif retval in ["given", "givenname"]:
 | 
					    elif retval in ["Title", _("Title")]:
 | 
				
			||||||
        retval = "firstname"
 | 
					        return "title"
 | 
				
			||||||
 | 
					    elif retval in ["Prefix", _("Prefix")]:
 | 
				
			||||||
 | 
					        return "prefix"
 | 
				
			||||||
 | 
					    elif retval in ["Suffix", _("Suffix")]:
 | 
				
			||||||
 | 
					        return "suffix"
 | 
				
			||||||
 | 
					    elif retval in ["Gender", _("Gender")]:
 | 
				
			||||||
 | 
					        return "gender"
 | 
				
			||||||
 | 
					    elif retval in ["Source", _("Source")]:
 | 
				
			||||||
 | 
					        return "source"
 | 
				
			||||||
 | 
					    elif retval in ["Note", _("Note")]:
 | 
				
			||||||
 | 
					        return "note"
 | 
				
			||||||
 | 
					    elif retval in ["Birthplace", "Birth place", _("Birth place")]:
 | 
				
			||||||
 | 
					        return "birthplace"
 | 
				
			||||||
 | 
					    elif retval in ["Birthdate", "Birth date", _("Birth date")]:
 | 
				
			||||||
 | 
					        return "birthdate"
 | 
				
			||||||
 | 
					    elif retval in ["Birthsource", "Birth source", _("Birth source")]:
 | 
				
			||||||
 | 
					        return "birthsource"
 | 
				
			||||||
 | 
					    elif retval in ["Deathplace", "Death place", _("Death place")]:
 | 
				
			||||||
 | 
					        return "deathplace"
 | 
				
			||||||
 | 
					    elif retval in ["Deathdate", "Death date", _("Death date")]:
 | 
				
			||||||
 | 
					        return "deathdate"
 | 
				
			||||||
 | 
					    elif retval in ["Deathsource", "Death source", _("Death source")]:
 | 
				
			||||||
 | 
					        return "deathsource"
 | 
				
			||||||
 | 
					    elif retval in ["Deathcause", "Death cause", _("Death cause")]:
 | 
				
			||||||
 | 
					        return "deathcause"
 | 
				
			||||||
 | 
					    elif retval in ["Grampsid", "Gramps id", _("Gramps id")]:
 | 
				
			||||||
 | 
					        return "grampsid"
 | 
				
			||||||
 | 
					    elif retval in ["Person", _("Person")]:
 | 
				
			||||||
 | 
					        return "person"
 | 
				
			||||||
 | 
					    # ----------------------------------
 | 
				
			||||||
 | 
					    elif retval in ["Child", _("Child")]:
 | 
				
			||||||
 | 
					        return "child"
 | 
				
			||||||
 | 
					    elif retval in ["Source", _("Source")]:
 | 
				
			||||||
 | 
					        return "source"
 | 
				
			||||||
 | 
					    elif retval in ["Family", _("Family")]:
 | 
				
			||||||
 | 
					        return "family"
 | 
				
			||||||
 | 
					    # ----------------------------------
 | 
				
			||||||
 | 
					    elif retval in ["Mother", _("Mother"), 
 | 
				
			||||||
 | 
					                    "Wife", _("Wife"),
 | 
				
			||||||
 | 
					                    "Parent2", _("Parent2")):
 | 
				
			||||||
 | 
					        return "wife"
 | 
				
			||||||
 | 
					    elif retval in ["Father", _("Father"), 
 | 
				
			||||||
 | 
					                    "Husband", _("Husband"),
 | 
				
			||||||
 | 
					                    "Parent1", _("Parent1")]:
 | 
				
			||||||
 | 
					        return "husband"
 | 
				
			||||||
 | 
					    elif retval in ["Marriage", _("Marriage")]:
 | 
				
			||||||
 | 
					        return "marriage"
 | 
				
			||||||
 | 
					    elif retval in ["Date", _("Date")]:
 | 
				
			||||||
 | 
					        return "date"
 | 
				
			||||||
 | 
					    elif retval in ["Place", _("Place")]:
 | 
				
			||||||
 | 
					        return "place"
 | 
				
			||||||
 | 
					    # lowercase
 | 
				
			||||||
 | 
					    elif retval in ["lastname", 
 | 
				
			||||||
 | 
					                  "surname", _("surname")]:
 | 
				
			||||||
 | 
					        return "surname"
 | 
				
			||||||
 | 
					    elif retval in ["firstname", 
 | 
				
			||||||
 | 
					                    "given name", _("given name"), 
 | 
				
			||||||
 | 
					                    "given", _("given")]:
 | 
				
			||||||
 | 
					        return "firstname"
 | 
				
			||||||
 | 
					    elif retval in ["callname", 
 | 
				
			||||||
 | 
					                    "call name", _("call name"),
 | 
				
			||||||
 | 
					                    "call", _("call")]:
 | 
				
			||||||
 | 
					        return "callname"
 | 
				
			||||||
 | 
					    elif retval in ["title", _("title")]:
 | 
				
			||||||
 | 
					        return "title"
 | 
				
			||||||
 | 
					    elif retval in ["prefix", _("prefix")]:
 | 
				
			||||||
 | 
					        return "prefix"
 | 
				
			||||||
 | 
					    elif retval in ["suffix", _("suffix")]:
 | 
				
			||||||
 | 
					        return "suffix"
 | 
				
			||||||
 | 
					    elif retval in ["gender", _("gender")]:
 | 
				
			||||||
 | 
					        return "gender"
 | 
				
			||||||
 | 
					    elif retval in ["source", _("source")]:
 | 
				
			||||||
 | 
					        return "source"
 | 
				
			||||||
 | 
					    elif retval in ["note", _("note")]:
 | 
				
			||||||
 | 
					        return "note"
 | 
				
			||||||
 | 
					    elif retval in ["birthplace", "birth place", _("birth place")]:
 | 
				
			||||||
 | 
					        return "birthplace"
 | 
				
			||||||
 | 
					    elif retval in ["birthdate", "birth date", _("birth date")]:
 | 
				
			||||||
 | 
					        return "birthdate"
 | 
				
			||||||
 | 
					    elif retval in ["birthsource", "birth source", _("birth source")]:
 | 
				
			||||||
 | 
					        return "birthsource"
 | 
				
			||||||
 | 
					    elif retval in ["deathplace", "death place", _("death place")]:
 | 
				
			||||||
 | 
					        return "deathplace"
 | 
				
			||||||
 | 
					    elif retval in ["deathdate", "death date", _("death date")]:
 | 
				
			||||||
 | 
					        return "deathdate"
 | 
				
			||||||
 | 
					    elif retval in ["deathsource", "death source", _("death source")]:
 | 
				
			||||||
 | 
					        return "deathsource"
 | 
				
			||||||
 | 
					    elif retval in ["deathcause", "death cause", _("death cause")]:
 | 
				
			||||||
 | 
					        return "deathcause"
 | 
				
			||||||
 | 
					    elif retval in ["grampsid", "gramps id", _("gramps id")]:
 | 
				
			||||||
 | 
					        return "grampsid"
 | 
				
			||||||
 | 
					    elif retval in ["person", _("person")]:
 | 
				
			||||||
 | 
					        return "person"
 | 
				
			||||||
 | 
					    # ----------------------------------
 | 
				
			||||||
 | 
					    elif retval in ["child", _("child")]:
 | 
				
			||||||
 | 
					        return "child"
 | 
				
			||||||
 | 
					    elif retval in ["source", _("source")]:
 | 
				
			||||||
 | 
					        return "source"
 | 
				
			||||||
 | 
					    elif retval in ["family", _("family")]:
 | 
				
			||||||
 | 
					        return "family"
 | 
				
			||||||
 | 
					    # ----------------------------------
 | 
				
			||||||
 | 
					    elif retval in ["mother", _("mother"), 
 | 
				
			||||||
 | 
					                    "wife", _("wife"),
 | 
				
			||||||
 | 
					                    "parent2", _("parent2")):
 | 
				
			||||||
 | 
					        return "wife"
 | 
				
			||||||
 | 
					    elif retval in ["father", _("father"), 
 | 
				
			||||||
 | 
					                    "husband", _("husband"),
 | 
				
			||||||
 | 
					                    "parent1", _("parent1")]:
 | 
				
			||||||
 | 
					        return "husband"
 | 
				
			||||||
 | 
					    elif retval in ["marriage", _("marriage")]:
 | 
				
			||||||
 | 
					        return "marriage"
 | 
				
			||||||
 | 
					    elif retval in ["date", _("date")]:
 | 
				
			||||||
 | 
					        return "date"
 | 
				
			||||||
 | 
					    elif retval in ["place", _("place")]:
 | 
				
			||||||
 | 
					        return "place"
 | 
				
			||||||
 | 
					    #----------------------------------------------------
 | 
				
			||||||
    return retval
 | 
					    return retval
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def importData(db, filename, callback=None):
 | 
					def importData(db, filename, callback=None):
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user