From 0327f751c34233f5c393ad1b6f4410d0da0ea363 Mon Sep 17 00:00:00 2001 From: prculley Date: Mon, 5 Sep 2016 14:59:00 -0500 Subject: [PATCH 1/3] bug 9676 CSV import, fix failure for certain types of cross references --- gramps/plugins/importer/importcsv.py | 177 +++++++++++++-------------- 1 file changed, 84 insertions(+), 93 deletions(-) diff --git a/gramps/plugins/importer/importcsv.py b/gramps/plugins/importer/importcsv.py index ef890c482..b8c57d8a8 100644 --- a/gramps/plugins/importer/importcsv.py +++ b/gramps/plugins/importer/importcsv.py @@ -154,94 +154,79 @@ class CSVParser: self.place_types[custom_type] = 0 self.place_types[custom_type.lower()] = 0 column2label = { - "surname": ("Lastname", "Surname", _("Surname"), "lastname", - "last_name", "surname", _("surname")), - "firstname": ("Firstname", "Given name", _("Given name"), "Given", - _("Given"), "firstname", "first_name", "given_name", - "given name", _("given name"), "given", _("given")), - "callname": ("Callname", "Call name", _("Call name"), "Call", - _("Call"), "callname", "call_name", "call name", "call", - _("call")), - "title": ("Title", _("Person or Place|Title"), "title", _("Person or Place|title")), - "prefix": ("Prefix", _("Prefix"), "prefix", _("prefix")), - "suffix": ("Suffix", _("Suffix"), "suffix", _("suffix")), - "gender": ("Gender", _("Gender"), "gender", _("gender")), - "source": ("Source", _("Source"), "source", _("source")), - "note": ("Note", _("Note"), "note", _("note")), - "birthplace": ("Birthplace", "Birth place", _("Birth place"), - "birthplace", "birth_place", "birth place", _("birth place")), - "birthplace_id": ("Birthplaceid", "Birth place id", _("Birth place id"), - "birthplaceid", "birth_place_id", "birth place id", _("birth place id"), + "surname": ("lastname", "last_name", "surname", _("surname")), + "firstname": ("firstname", "first_name", "given_name", "given", + "given name", _("given name"), _("given")), + "callname": ("call name", _("Call name"), "callname", "call_name", + "call", _("call")), + "title": ("title", _("title"), _("Person or Place|title")), + "prefix": ("prefix", _("prefix")), + "suffix": ("suffix", _("suffix")), + "gender": ("gender", _("gender")), + "source": ("source", _("source")), + "note": ("note", _("note")), + "birthplace": ("birthplace", "birth_place", "birth place", + _("birth place")), + "birthplace_id": ("birthplaceid", "birth_place_id", + "birth place id", _("birth place id"), "birthplace_id"), - "birthdate": ("Birthdate", "Birth date", _("Birth date"), - "birthdate", "birth_date", "birth date", _("birth date")), - "birthsource": ("Birthsource", "Birth source", _("Birth source"), - "birthsource", "birth_source", "birth source", - _("birth source")), - "baptismplace": ("Baptismplace", "Baptism place", - _("Baptism place"), "baptismplace", "baptism place", - _("baptism place")), - "baptismplace_id": ("Baptismplaceid", "Baptism place id", - _("Baptism place id"), "baptismplaceid", "baptism place id", + "birthdate": ("birthdate", "birth_date", "birth date", + _("birth date")), + "birthsource": ("birthsource", "birth_source", "birth source", + _("birth source")), + "baptismplace": ("baptismplace", "baptism place", + _("baptism place")), + "baptismplace_id": ("baptismplaceid", "baptism place id", _("baptism place id"), "baptism_place_id", "baptismplace_id"), - "baptismdate": ("Baptismdate", "Baptism date", _("Baptism date"), - "baptismdate", "baptism date", _("baptism date")), - "baptismsource": ("Baptismsource", "Baptism source", - _("Baptism source"), "baptismsource", "baptism source", - _("baptism source")), - "burialplace": ("Burialplace", "Burial place", _("Burial place"), - "burialplace", "burial place", _("burial place")), - "burialplace_id": ("Burialplaceid", "Burial place id", _("Burial place id"), - "burialplaceid", "burial place id", _("burial place id"), - "burial_place_id", "burialplace_id"), - "burialdate": ("Burialdate", "Burial date", _("Burial date"), - "burialdate", "burial date", _("burial date")), - "burialsource": ("Burialsource", "Burial source", - _("Burial source"), "burialsource", "burial source", - _("burial source")), - "deathplace": ("Deathplace", "Death place", _("Death place"), - "deathplace", "death_place", "death place", _("death place")), - "deathplace_id": ("Deathplaceid", "Death place id", _("Death place id"), - "deathplaceid", "death_place_id", "death place id", _("death place id"), - "death_place_id", "deathplace_id"), - "deathdate": ("Deathdate", "Death date", _("Death date"), - "deathdate", "death_date", "death date", _("death date")), - "deathsource": ("Deathsource", "Death source", _("Death source"), - "deathsource", "death_source", "death source", - _("death source")), - "deathcause": ("Deathcause", "Death cause", _("Death cause"), - "deathcause", "death_cause", "death cause", _("death cause")), - "grampsid": ("Grampsid", "ID", "Gramps id", _("Gramps ID"), - "grampsid", "id", "gramps_id", "gramps id", _("Gramps id")), - "person": ("Person", _("Person"), "person", _("person")), + "baptismdate": ("baptismdate", "baptism date", _("baptism date")), + "baptismsource": ("baptismsource", "baptism source", + _("baptism source")), + "burialplace": ("burialplace", "burial place", _("burial place")), + "burialplace_id": ("burialplaceid", "burial place id", + _("burial place id"), "burial_place_id", + "burialplace_id"), + "burialdate": ("burialdate", "burial date", _("burial date")), + "burialsource": ("burialsource", "burial source", + _("burial source")), + "deathplace": ("deathplace", "death_place", "death place", + _("death place")), + "deathplace_id": ("deathplaceid", "death place id", + _("death place id"), "death_place_id", + "deathplace_id"), + "deathdate": ("deathdate", "death_date", "death date", + _("death date")), + "deathsource": ("deathsource", "death_source", "death source", + _("death source")), + "deathcause": ("deathcause", "death_cause", "death cause", + _("death cause")), + "grampsid": (_("Gramps ID"), "grampsid", "id", "gramps_id", + "gramps id"), + "person": ("person", _("person")), # ---------------------------------- - "child": ("Child", _("Child"), "child", _("child")), - "family": ("Family", _("Family"), "family", _("family")), + "child": ("child", _("child")), + "family": ("family", _("family")), # ---------------------------------- - "wife": ("Mother", _("Mother"), "Wife", _("Wife"), "Parent2", - _("Parent2"), "mother", _("mother"), "wife", _("wife"), - "parent2", _("parent2")), - "husband": ("Father", _("Father"), "Husband", _("Husband"), - "Parent1", _("Parent1"), "father", _("father"), "husband", - _("husband"), "parent1", _("parent1")), - "marriage": ("Marriage", _("Marriage"), "marriage", _("marriage")), - "date": ("Date", _("Date"), "date", _("date")), - "place": ("Place", _("Place"), "place", _("place")), - "place_id": ("Placeid", "place id", "Place id", "place_id", "placeid"), - "name": ("Name", _("Name"), "name", _("name")), - "type": ("Type", _("Type"), "type", _("type")), - "latitude": ("Latitude", _("latitude"), "latitude", _("latitude")), - "longitude": ("Longitude", _("Longitude"), "longitude", _("longitude")), - "code": ("Code", _("Code"), "code", _("code")), - "enclosed_by": ("Enclosed by", _("Enclosed by"), "enclosed by", _("enclosed by"), - "enclosed_by", _("enclosed_by"), "Enclosed_by", _("Enclosed_by"), - "enclosedby") + "wife": ("mother", _("mother"), "wife", _("wife"), + "parent2", _("parent2")), + "husband": ("father", _("father"), "husband", _("husband"), + "parent1", _("parent1")), + "marriage": ("marriage", _("marriage")), + "date": ("date", _("date")), + "place": ("place", _("place")), + "place_id": ("place id", "place_id", "placeid", _("place id")), + "name": ("name", _("name")), + "type": ("type", _("type")), + "latitude": ("latitude", _("latitude")), + "longitude": ("longitude", _("longitude")), + "code": ("code", _("code")), + "enclosed_by": ("enclosed by", _("enclosed by"), + "enclosed_by", _("enclosed_by"), "enclosedby") } lab2col_dict = [] for key in list(column2label.keys()): for val in column2label[key]: - lab2col_dict.append((val, key)) + lab2col_dict.append((val.lower(), key)) self.label2column = dict(lab2col_dict) if default_tag_format: name = time.strftime(default_tag_format) @@ -283,10 +268,12 @@ class CSVParser: return self.lookup(type_, id_) else: return db_lookup - elif id_.lower() in self.fref: - return self.fref[id_.lower()] else: - return None + id_ = self.db.fid2user_format(id_) + if id_.lower() in self.fref: + return self.fref[id_.lower()] + else: + return None elif type_ == "person": if id_.startswith("[") and id_.endswith("]"): id_ = self.db.id2user_format(id_[1:-1]) @@ -295,22 +282,26 @@ class CSVParser: return self.lookup(type_, id_) else: return db_lookup - elif id_.lower() in self.pref: - return self.pref[id_.lower()] else: - return None + id_ = self.db.id2user_format(id_) + if id_.lower() in self.pref: + return self.pref[id_.lower()] + else: + return None elif type_ == "place": if id_.startswith("[") and id_.endswith("]"): - id_ = self.db.id2user_format(id_[1:-1]) + id_ = self.db.pid2user_format(id_[1:-1]) db_lookup = self.db.get_place_from_gramps_id(id_) if db_lookup is None: return self.lookup(type_, id_) else: return db_lookup - elif id_.lower() in self.placeref: - return self.placeref[id_.lower()] else: - return None + id_ = self.db.pid2user_format(id_) + if id_.lower() in self.placeref: + return self.placeref[id_.lower()] + else: + return None else: LOG.warning("invalid lookup type in CSV import: '%s'" % type_) return None @@ -382,7 +373,7 @@ class CSVParser: continue ###################################### if header is None: - header = [self.cleanup_column_name(r) for r in row] + header = [self.cleanup_column_name(r.lower()) for r in row] col = {} count = 0 for key in header: @@ -433,7 +424,7 @@ class CSVParser: wife.set_gender(Person.FEMALE) self.db.commit_person(wife, self.trans) if marriage_ref: - self.storeup("family", marriage_ref.lower(), family) + self.storeup("family", marriage_ref, family) if marriagesource: # add, if new new, marriagesource = self.get_or_create_source(marriagesource) @@ -786,8 +777,8 @@ class CSVParser: place = self.create_place() if place_id is not None: if place_id.startswith("[") and place_id.endswith("]"): - place.gramps_id = self.db.id2user_format(place_id[1:-1]) - self.storeup("place", place_id.lower(), place) + place.gramps_id = self.db.pid2user_format(place_id[1:-1]) + self.storeup("place", place_id, place) if place_title is not None: place.title = place_title if place_name is not None: From 8d989cc6f64a1d1eafabc66909c12d77625936d6 Mon Sep 17 00:00:00 2001 From: prculley Date: Mon, 5 Sep 2016 16:53:39 -0500 Subject: [PATCH 2/3] update test files --- data/tests/imp_sample_csv.csv | 246 +++++----- data/tests/imp_sample_csv.gramps | 758 ++++++++++++++++--------------- 2 files changed, 506 insertions(+), 498 deletions(-) diff --git a/data/tests/imp_sample_csv.csv b/data/tests/imp_sample_csv.csv index b58709cea..79e9f9a34 100644 --- a/data/tests/imp_sample_csv.csv +++ b/data/tests/imp_sample_csv.csv @@ -1,123 +1,123 @@ -Place,Title,Name,Type,Latitude,Longitude,Code,Enclosed_by,Date -[P0000],"Löderup, Malmöhus Län, Sweden","Löderup, Malmöhus Län, Sweden",Unknown,,,,, -[P0001],"Sparks, Washoe Co., NV","Sparks, Washoe Co., NV",Unknown,,,,, -[P0002],"San Francisco, San Francisco Co., CA","San Francisco, San Francisco Co., CA",Unknown,,,,, -[P0003],"Rønne, Bornholm, Denmark","Rønne, Bornholm, Denmark",Unknown,,,,, -[P0004],"Gladsax, Kristianstad Län, Sweden","Gladsax, Kristianstad Län, Sweden",Unknown,,,,, -[P0005],"Reno, Washoe Co., NV","Reno, Washoe Co., NV",Unknown,,,,, -[P0006],"Hayward, Alameda Co., CA","Hayward, Alameda Co., CA",Unknown,,,,, -[P0007],"Community Presbyterian Church, Danville, CA","Community Presbyterian Church, Danville, CA",Unknown,,,,, -[P0008],Sweden,Sweden,Unknown,,,,, -[P0009],"Grostorp, Kristianstad Län, Sweden","Grostorp, Kristianstad Län, Sweden",Unknown,,,,, -[P0010],"Copenhagen, Denmark","Copenhagen, Denmark",Unknown,,,,, -[P0011],"Hoya/Jona/Hoia, Sweden","Hoya/Jona/Hoia, Sweden",Unknown,,,,, -[P0012],"Simrishamn, Kristianstad Län, Sweden","Simrishamn, Kristianstad Län, Sweden",Unknown,,,,, -[P0013],"Fremont, Alameda Co., CA","Fremont, Alameda Co., CA",Unknown,,,,, -[P0016],"Santa Rosa, Sonoma Co., CA","Santa Rosa, Sonoma Co., CA",Unknown,,,,, -[P0017],"San Jose, Santa Clara Co., CA","San Jose, Santa Clara Co., CA",Unknown,,,,, -[P0018],UC Berkeley,UC Berkeley,Unknown,,,,, -[P0019],"Smestorp, Kristianstad Län, Sweden","Smestorp, Kristianstad Län, Sweden",Unknown,,,,, -[P0020],"Tommarp, Kristianstad Län, Sweden","Tommarp, Kristianstad Län, Sweden",Unknown,,,,, -[P0021],"Rønne Bornholm, Denmark","Rønne Bornholm, Denmark",Unknown,,,,, -[P0022],"Woodland, Yolo Co., CA","Woodland, Yolo Co., CA",Unknown,,,,, -[P0023],"San Ramon, Conta Costa Co., CA","San Ramon, Conta Costa Co., CA",Unknown,,,,, -[P0026],United States of America,USA,Country,,,,, -[P0028],"California, USA",California,State,,,,[P0026],2016-06-04 -[P0025],"Colorado, USA",Colorado,State,,,,[P0026], -[P0027],"Sacramento Co., California, USA",Sacramento Co.,County,,,,[P0028],2016-06-01 -[P0015],"Sacramento, Sacramento Co., CA","Sacramento, Sacramento Co., CA",City,,,,[P0027],2016-06-04 -[P0024],"Denver Co., Colorado, USA",Denver Co.,County,,,,[P0025], -[P0014],"Denver, Denver Co., CO","Denver, Denver Co., CO",City,39.7392,104.9903 W,,[P0024], - -Person,Surname,Given,Call,Suffix,Prefix,Title,Gender,Birth date,Birth place,Birth source,Baptism date,Baptism place,Baptism source,Death date,Death place,Death source,Burial date,Burial place,Burial source,Note -[I0030],Adams,Janice Ann,,,,,female,26 Aug 1965,"Fremont, Alameda Co., CA",,,,,,,,,,, -[I0016],Anderson,Jennifer,,,,,female,5 Nov 1907,"Rønne, Bornholm, Denmark",,,,,29 May 1985,"San Francisco, San Francisco Co., CA",,,,, -[I0025],Ericsdotter,Marta,,,,,female,about 1775,Sweden,,,,,,,,,,, -[I0041],Green,Janis Elaine,,,,,female,2 Dec 1935,,,,,,,,,,,, -[I0000],Hansdotter,Anna,,,,,female,2 Oct 1864,"Löderup, Malmöhus Län, Sweden",,,,,29 Sep 1945,"Sparks, Washoe Co., NV",,,,, -[I0038],Hansdotter,Kerstina,,,,,female,29 Nov 1832,"Smestorp, Kristianstad Län, Sweden",,,,,before 1908,Sweden,,,,, -[I0032],Horne,Darcy,,,,,female,2 Jul 1966,"Sacramento, Sacramento Co., CA",,,,,,,,,,, -[I0036],Jefferson,Elna,,,,,female,14 Sep 1800,"Gladsax, Kristianstad Län, Sweden",,,,,,Sweden,,,,, -[I0017],Jones,Lillie Harriet,,,,,female,2 May 1910,"Rønne, Bornholm, Denmark",,,,,26 Jun 1990,,,,,, -[I0042],Ke 柯,雪,,,,,male,,,,,,,,,,,,, -[I0013],Michaels,Evelyn,,,,,female,about 1897,,,,,,,,,,,, -[I0012],Nielsen,Herman Julius,,,,,male,31 Aug 1889,"Rønne, Bornholm, Denmark",,,,,1945,,,,,, -[I0031],Ohman,Marjorie,,,,,female,3 Jun 1903,"Denver, Denver Co., CO, Denver Co., Colorado, USA",,,,,22 Jun 1980,"Reno, Washoe Co., NV",,,,, -[I0034],Perkins,Alice Paula,,,,,female,22 Nov 1933,"Sparks, Washoe Co., NV",,,,,,,,,,, -[I0002],Smith,Amber Marie,,,,,female,12 Apr 1998,"Hayward, Alameda Co., CA",,,,,,,,,,, -[I0023],Smith,Astrid Shermanna Augusta,,,,,female,31 Jan 1889,"Rønne, Bornholm, Denmark",,,,,21 Dec 1963,"San Francisco, San Francisco Co., CA",,,,, -[I0020],Smith,Carl Emil,,,,,male,20 Dec 1899,"Rønne, Bornholm, Denmark",,,,,28 Jan 1959,"Reno, Washoe Co., NV",,,,, -[I0029],Smith,Craig Peter,,,,,male,after 1966,"San Francisco, San Francisco Co., CA",,,,,,,,,,, -[I0037],Smith,Edwin Michael,,,,,male,24 May 1961,"San Jose, Santa Clara Co., CA","Birth, Death and Marriage Records",,,,,,,,,, -[I0009],Smith,Emil,,,,,male,27 Sep 1860,"Simrishamn, Kristianstad Län, Sweden",,,,,,,,,,, -[I0019],Smith,Eric Lloyd,,,,Dr.,male,28 Aug 1963,"San Francisco, San Francisco Co., CA",,,,,,,,,,, -[I0015],Smith,Gus,,,,,male,11 Sep 1897,"Rønne, Bornholm, Denmark",,,,,21 Oct 1963,"San Francisco, San Francisco Co., CA",,,,, -[I0024],Smith,Gustaf,,Sr.,,,male,28 Nov 1862,"Grostorp, Kristianstad Län, Sweden",,,,,before 23 Jul 1930,"Sparks, Washoe Co., NV",,,,, -[I0011],Smith,Hanna,,,,,female,29 Jan 1821,"Gladsax, Kristianstad Län, Sweden",,,,,,,,,,, -[I0010],Smith,Hans Peter,,,,,male,17 Apr 1904,"Rønne, Bornholm, Denmark",Birth Records,,,,29 Jan 1977,"San Francisco, San Francisco Co., CA",,5 Feb 1977,"San Francisco, San Francisco Co., CA",findagrave.com, -[I0021],Smith,Hjalmar,,,,,male,31 Jan 1893,"Rønne, Bornholm, Denmark",,,,,25 Sep 1894,"Rønne, Bornholm, Denmark",,,,, -[I0008],Smith,Hjalmar,,,,,male,7 Apr 1895,"Rønne, Bornholm, Denmark",,3 Jun 1895,"Rønne Bornholm, Denmark",,26 Jun 1975,"Reno, Washoe Co., NV",,,,, -[I0007],Smith,Ingar,,,,,female,after 1823,"Gladsax, Kristianstad Län, Sweden",,,,,,,,,,, -[I0027],Smith,Ingeman,,,,,male,about 1770,Sweden,,,,,,,,,,, -[I0004],Smith,Ingeman,,,,,male,29 Jan 1826,"Gladsax, Kristianstad Län, Sweden",,,,,,,,,,, -[I0018],Smith,John Hjalmar,,,,,male,30 Jan 1932,"San Francisco, San Francisco Co., CA",,,,,,,,,,, -[I0001],Smith,Keith Lloyd,,,,,male,11 Aug 1966,"San Francisco, San Francisco Co., CA",,,,,,,,,,, -[I0026],Smith,Kirsti Marie,,,,,female,15 Dec 1886,"Rønne, Bornholm, Denmark",,,,,18 Jul 1966,"San Francisco, San Francisco Co., CA",,,,, -[I0035],Smith,Lars Peter,,,,,male,16 Sep 1991,"Santa Rosa, Sonoma Co., CA",,,,,,,,,,, -[I0033],Smith,Lloyd,,,,,male,13 Mar 1935,"San Francisco, San Francisco Co., CA",,,,,,,,,,, -[I0003],Smith,Magnes,,,,,male,6 Oct 1858,"Simrishamn, Kristianstad Län, Sweden",,,,,20 Feb 1910,"Rønne, Bornholm, Denmark",,,,, -[I0040],Smith,Marjorie Alice,,,,,female,5 Feb 1960,"San Jose, Santa Clara Co., CA",,,,,,,,,,, -[I0014],Smith,Marjorie Lee,,,,,female,4 Nov 1934,"Reno, Washoe Co., NV",,,,,,,,,,, -[I0022],Smith,Martin,,,,,male,19 Nov 1830,"Gladsax, Kristianstad Län, Sweden",,23 Nov 1830,"Gladsax, Kristianstad Län, Sweden",,between 1899 and 1905,Sweden,,,,, -[I0039],Smith,Martin,,,,,male,between 1794 and 1796,"Tommarp, Kristianstad Län, Sweden",,,,,,Sweden,,,,, -[I0005],Smith,Mason Michael,,,,,male,26 Jun 1996,"Hayward, Alameda Co., CA",,,,,,,,,,, -[I0028],Streiffert,Anna,,,,,female,23 Sep 1860,"Hoya/Jona/Hoia, Sweden",,,,,2 Feb 1927,"Rønne, Bornholm, Denmark",,,,, -[I0006],Willard,Edwin,,,,,male,about 1886,,,,,,,,,,,, -[I0043],リチミシキスイミ,ピーター,,,,,male,,,,,,,,,,,,, - -Marriage,Husband,Wife,Date,Place,Source,Note -[F0000],[I0039],[I0036],about 1816,"Gladsax, Kristianstad Län, Sweden",, -[F0001],[I0027],[I0025],about 1790,Sweden,, -[F0002],[I0022],[I0038],about 1856,,, -[F0003],[I0024],[I0000],27 Nov 1885,"Rønne, Bornholm, Denmark",, -[F0004],[I0006],[I0026],about 1910,,, -[F0005],[I0012],[I0023],30 Nov 1912,"Rønne, Bornholm, Denmark",, -[F0006],[I0008],[I0031],31 Oct 1927,"Reno, Washoe Co., NV",, -[F0007],[I0015],[I0013],about 1920,,, -[F0008],[I0033],[I0041],10 Aug 1958,"San Francisco, San Francisco Co., CA",, -[F0009],[I0010],[I0017],,,, -[F0010],[I0019],[I0032],12 Jul 1986,"Woodland, Yolo Co., CA",, -[F0011],[I0003],[I0028],24 Aug 1884,"Rønne, Bornholm, Denmark",, -[F0012],[I0018],[I0034],4 Jun 1954,"Sparks, Washoe Co., NV",Marriage Certificae, -[F0013],[I0037],[I0030],27 May 1995,"San Ramon, Conta Costa Co., CA",, -[F0014],[I0010],[I0016],,,, - -Family,Child -[F0000],[I0011] -[F0000],[I0007] -[F0000],[I0004] -[F0000],[I0022] -[F0001],[I0039] -[F0002],[I0003] -[F0002],[I0009] -[F0002],[I0024] -[F0003],[I0026] -[F0003],[I0023] -[F0003],[I0021] -[F0003],[I0008] -[F0003],[I0015] -[F0003],[I0020] -[F0003],[I0010] -[F0005],[I0042] -[F0006],[I0018] -[F0006],[I0014] -[F0008],[I0019] -[F0008],[I0001] -[F0008],[I0029] -[F0009],[I0033] -[F0010],[I0035] -[F0012],[I0040] -[F0012],[I0037] -[F0013],[I0005] -[F0013],[I0002] - +Place,Title,Name,Type,Latitude,Longitude,Code,Enclosed_by,Date,,,,,,,,,,,,, +[P0000],"Löderup, Malmöhus Län, Sweden","Löderup, Malmöhus Län, Sweden",Unknown,,,,,,,,,,,,,,,,,, +[P0001],"Sparks, Washoe Co., NV","Sparks, Washoe Co., NV",Unknown,,,,,,,,,,,,,,,,,, +[P0002],"San Francisco, San Francisco Co., CA","San Francisco, San Francisco Co., CA",Unknown,,,,,,,,,,,,,,,,,, +[P0003],"Rønne, Bornholm, Denmark","Rønne, Bornholm, Denmark",Unknown,,,,,,,,,,,,,,,,,, +[P0004],"Gladsax, Kristianstad Län, Sweden","Gladsax, Kristianstad Län, Sweden",Unknown,,,,,,,,,,,,,,,,,, +[P0005],"Reno, Washoe Co., NV","Reno, Washoe Co., NV",Unknown,,,,,,,,,,,,,,,,,, +[P0006],"Hayward, Alameda Co., CA","Hayward, Alameda Co., CA",Unknown,,,,,,,,,,,,,,,,,, +[P0007],"Community Presbyterian Church, Danville, CA","Community Presbyterian Church, Danville, CA",Unknown,,,,,,,,,,,,,,,,,, +[P0008],Sweden,Sweden,Unknown,,,,,,,,,,,,,,,,,, +[P0009],"Grostorp, Kristianstad Län, Sweden","Grostorp, Kristianstad Län, Sweden",Unknown,,,,,,,,,,,,,,,,,, +[P0010],"Copenhagen, Denmark","Copenhagen, Denmark",Unknown,,,,,,,,,,,,,,,,,, +[P0011],"Hoya/Jona/Hoia, Sweden","Hoya/Jona/Hoia, Sweden",Unknown,,,,,,,,,,,,,,,,,, +[P0012],"Simrishamn, Kristianstad Län, Sweden","Simrishamn, Kristianstad Län, Sweden",Unknown,,,,,,,,,,,,,,,,,, +[P0013],"Fremont, Alameda Co., CA","Fremont, Alameda Co., CA",Unknown,,,,,,,,,,,,,,,,,, +[P0016],"Santa Rosa, Sonoma Co., CA","Santa Rosa, Sonoma Co., CA",Unknown,,,,,,,,,,,,,,,,,, +[P0017],"San Jose, Santa Clara Co., CA","San Jose, Santa Clara Co., CA",Unknown,,,,,,,,,,,,,,,,,, +[P0019],"Smestorp, Kristianstad Län, Sweden","Smestorp, Kristianstad Län, Sweden",Unknown,,,,,,,,,,,,,,,,,, +[P0020],"Tommarp, Kristianstad Län, Sweden","Tommarp, Kristianstad Län, Sweden",Unknown,,,,,,,,,,,,,,,,,, +[P0021],"Rønne Bornholm, Denmark","Rønne Bornholm, Denmark",Unknown,,,,,,,,,,,,,,,,,, +[P0022],"Woodland, Yolo Co., CA","Woodland, Yolo Co., CA",Unknown,,,,,,,,,,,,,,,,,, +[P0023],"San Ramon, Conta Costa Co., CA","San Ramon, Conta Costa Co., CA",Unknown,,,,,,,,,,,,,,,,,, +[P0026],United States of America,USA,Country,,,,,,,,,,,,,,,,,, +[P0028],"California, USA",California,State,,,,[P0026],2016-06-04,,,,,,,,,,,,, +[P0025],"Colorado, USA",Colorado,State,,,,[P0026],,,,,,,,,,,,,, +[P0027],"Sacramento Co., California, USA",Sacramento Co.,County,,,,[P0028],2016-06-01,,,,,,,,,,,,, +[P0015],"Sacramento, Sacramento Co., CA","Sacramento, Sacramento Co., CA",City,,,,[P0027],2016-06-04,,,,,,,,,,,,, +[P0024],"Denver Co., Colorado, USA",Denver Co.,County,,,,[P0025],,,,,,,,,,,,,, +[P0014],"Denver, Denver Co., CO","Denver, Denver Co., CO",City,39.7392,104.9903 W,,[P0024],,,,,,,,,,,,,, +L18,UC Berkeley,UC Berkeley,Unknown,,,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,,, +Person,Surname,Given,Call,Suffix,Prefix,Title,Gender,Birth date,Birth place,birthplaceid,Birth source,Baptism date,Baptism place,Baptism source,Death date,Death place,Death source,Burial date,Burial place,Burial source,Note +[I0030],Adams,Janice Ann,,,,,female,26 Aug 1965,"Fremont, Alameda Co., CA",,,,,,,,,,,, +[I0016],Anderson,Jennifer,,,,,female,5 Nov 1907,"Rønne, Bornholm, Denmark",,,,,,29-May-85,"San Francisco, San Francisco Co., CA",,,,, +[I0025],Ericsdotter,Marta,,,,,female,about 1775,Sweden,,,,,,,,,,,, +[I0041],Green,Janis Elaine,,,,,female,2 Dec 1935,,,,,,,,,,,,, +[I0000],Hansdotter,Anna,,,,,female,2 Oct 1864,"Löderup, Malmöhus Län, Sweden",,,,,,29-Sep-45,"Sparks, Washoe Co., NV",,,,, +[I0038],Hansdotter,Kerstina,,,,,female,29 Nov 1832,"Smestorp, Kristianstad Län, Sweden",,,,,,before 1908,Sweden,,,,, +[I0032],Horne,Darcy,,,,,female,2 Jul 1966,"Sacramento, Sacramento Co., CA",,,,,,,,,,,, +[I0036],Jefferson,Elna,,,,,female,14 Sep 1800,"Gladsax, Kristianstad Län, Sweden",,,,,,,Sweden,,,,, +[I0017],Jones,Lillie Harriet,,,,,female,2 May 1910,"Rønne, Bornholm, Denmark",,,,,,26-Jun-90,,,,,, +[I0013],Michaels,Evelyn,,,,,female,about 1897,,,,,,,,,,,,, +[I0012],Nielsen,Herman Julius,,,,,male,31 Aug 1889,"Rønne, Bornholm, Denmark",,,,,,1945,,,,,, +[I0031],Ohman,Marjorie,,,,,female,3 Jun 1903,"Denver, Denver Co., CO, Denver Co., Colorado, USA",,,,,,22-Jun-80,"Reno, Washoe Co., NV",,,,, +[I0034],Perkins,Alice Paula,,,,,female,22 Nov 1933,"Sparks, Washoe Co., NV",,,,,,,,,,,, +[I0002],Smith,Amber Marie,,,,,female,12 Apr 1998,"Hayward, Alameda Co., CA",,,,,,,,,,,, +[I0023],Smith,Astrid Shermanna Augusta,,,,,female,31 Jan 1889,"Rønne, Bornholm, Denmark",,,,,,21-Dec-63,"San Francisco, San Francisco Co., CA",,,,, +[I0020],Smith,Carl Emil,,,,,male,20 Dec 1899,"Rønne, Bornholm, Denmark",,,,,,28-Jan-59,"Reno, Washoe Co., NV",,,,, +[I0029],Smith,Craig Peter,,,,,male,after 1966,"San Francisco, San Francisco Co., CA",,,,,,,,,,,, +[I0037],Smith,Edwin Michael,,,,,male,24 May 1961,"San Jose, Santa Clara Co., CA",,"Birth, Death and Marriage Records",,,,,,,,,, +[I0009],Smith,Emil,,,,,male,27 Sep 1860,"Simrishamn, Kristianstad Län, Sweden",,,,,,,,,,,, +[I0019],Smith,Eric Lloyd,,,,Dr.,male,28 Aug 1963,"San Francisco, San Francisco Co., CA",,,,,,,,,,,, +[I0015],Smith,Gus,,,,,male,11 Sep 1897,"Rønne, Bornholm, Denmark",,,,,,21-Oct-63,"San Francisco, San Francisco Co., CA",,,,, +[I0024],Smith,Gustaf,,Sr.,,,male,28 Nov 1862,"Grostorp, Kristianstad Län, Sweden",,,,,,before 23 Jul 1930,"Sparks, Washoe Co., NV",,,,, +[I0011],Smith,Hanna,,,,,female,29 Jan 1821,"Gladsax, Kristianstad Län, Sweden",,,,,,,,,,,, +[I0010],Smith,Hans Peter,,,,,male,17 Apr 1904,"Rønne, Bornholm, Denmark",,Birth Records,,,,29-Jan-77,"San Francisco, San Francisco Co., CA",,5-Feb-77,"San Francisco, San Francisco Co., CA",findagrave.com, +[I0021],Smith,Hjalmar,,,,,male,31 Jan 1893,"Rønne, Bornholm, Denmark",,,,,,25 Sep 1894,"Rønne, Bornholm, Denmark",,,,, +[I0008],Smith,Hjalmar,,,,,male,7 Apr 1895,"Rønne, Bornholm, Denmark",,,3 Jun 1895,"Rønne Bornholm, Denmark",,26-Jun-75,"Reno, Washoe Co., NV",,,,, +[I0007],Smith,Ingar,,,,,female,after 1823,"Gladsax, Kristianstad Län, Sweden",,,,,,,,,,,, +[I0027],Smith,Ingeman,,,,,male,about 1770,Sweden,,,,,,,,,,,, +[I0004],Smith,Ingeman,,,,,male,29 Jan 1826,"Gladsax, Kristianstad Län, Sweden",,,,,,,,,,,, +[I0018],Smith,John Hjalmar,,,,,male,30 Jan 1932,"San Francisco, San Francisco Co., CA",,,,,,,,,,,, +[I0001],Smith,Keith Lloyd,,,,,male,11 Aug 1966,"San Francisco, San Francisco Co., CA",,,,,,,,,,,, +[I0026],Smith,Kirsti Marie,,,,,female,15 Dec 1886,"Rønne, Bornholm, Denmark",,,,,,18-Jul-66,"San Francisco, San Francisco Co., CA",,,,, +[I0035],Smith,Lars Peter,,,,,male,16 Sep 1991,"Santa Rosa, Sonoma Co., CA",,,,,,,,,,,, +[I0033],Smith,Lloyd,,,,,male,13 Mar 1935,"San Francisco, San Francisco Co., CA",,,,,,,,,,,, +[I0003],Smith,Magnes,,,,,male,6 Oct 1858,"Simrishamn, Kristianstad Län, Sweden",,,,,,20-Feb-10,"Rønne, Bornholm, Denmark",,,,, +[I0040],Smith,Marjorie Alice,,,,,female,5 Feb 1960,"San Jose, Santa Clara Co., CA",,,,,,,,,,,, +[I0014],Smith,Marjorie Lee,,,,,female,4 Nov 1934,"Reno, Washoe Co., NV",,,,,,,,,,,, +[I0022],Smith,Martin,,,,,male,19 Nov 1830,"Gladsax, Kristianstad Län, Sweden",,,23 Nov 1830,"Gladsax, Kristianstad Län, Sweden",,between 1899 and 1905,Sweden,,,,, +[I0039],Smith,Martin,,,,,male,between 1794 and 1796,"Tommarp, Kristianstad Län, Sweden",,,,,,,Sweden,,,,, +[I0005],Smith,Mason Michael,,,,,male,26 Jun 1996,"Hayward, Alameda Co., CA",,,,,,,,,,,, +[I0028],Streiffert,Anna,,,,,female,23 Sep 1860,"Hoya/Jona/Hoia, Sweden",,,,,,2-Feb-27,"Rønne, Bornholm, Denmark",,,,, +[I0006],Willard,Edwin,,,,,male,about 1886,,,,,,,,,,,,, +X42,Ke 柯,雪,,,,,male,1-Jan-70,,L18,,,,,,,,,,, +X43,リチミシキスイミ,ピーター,,,,,male,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,,, +Marriage,Husband,Wife,Date,Place,Source,Note,,,,,,,,,,,,,,, +[F0000],[I0039],[I0036],about 1816,"Gladsax, Kristianstad Län, Sweden",,,,,,,,,,,,,,,,, +[F0001],[I0027],[I0025],about 1790,Sweden,,,,,,,,,,,,,,,,, +[F0002],[I0022],[I0038],about 1856,,,,,,,,,,,,,,,,,, +[F0003],[I0024],[I0000],27 Nov 1885,"Rønne, Bornholm, Denmark",,,,,,,,,,,,,,,,, +[F0004],[I0006],[I0026],about 1910,,,,,,,,,,,,,,,,,, +[F0006],[I0008],[I0031],31 Oct 1927,"Reno, Washoe Co., NV",,,,,,,,,,,,,,,,, +[F0007],[I0015],[I0013],about 1920,,,,,,,,,,,,,,,,,, +[F0008],[I0033],[I0041],10 Aug 1958,"San Francisco, San Francisco Co., CA",,,,,,,,,,,,,,,,, +[F0009],[I0010],[I0017],,,,,,,,,,,,,,,,,,, +[F0010],[I0019],[I0032],12 Jul 1986,"Woodland, Yolo Co., CA",,,,,,,,,,,,,,,,, +[F0011],[I0003],[I0028],24 Aug 1884,"Rønne, Bornholm, Denmark",,,,,,,,,,,,,,,,, +[F0012],[I0018],[I0034],4 Jun 1954,"Sparks, Washoe Co., NV",Marriage Certificae,,,,,,,,,,,,,,,, +[F0013],[I0037],[I0030],27 May 1995,"San Ramon, Conta Costa Co., CA",,,,,,,,,,,,,,,,, +[F0014],[I0010],[I0016],,,,,,,,,,,,,,,,,,, +Z5,[I0012],[I0023],30 Nov 1912,"Rønne, Bornholm, Denmark",,,,,,,,,,,,,,,,, +,,,,,,,,,,,,,,,,,,,,, +Family,Child,,,,,,,,,,,,,,,,,,,, +[F0000],[I0011],,,,,,,,,,,,,,,,,,,, +[F0000],[I0007],,,,,,,,,,,,,,,,,,,, +[F0000],[I0004],,,,,,,,,,,,,,,,,,,, +[F0000],[I0022],,,,,,,,,,,,,,,,,,,, +[F0001],[I0039],,,,,,,,,,,,,,,,,,,, +[F0002],[I0003],,,,,,,,,,,,,,,,,,,, +[F0002],[I0009],,,,,,,,,,,,,,,,,,,, +[F0002],[I0024],,,,,,,,,,,,,,,,,,,, +[F0003],[I0026],,,,,,,,,,,,,,,,,,,, +[F0003],[I0023],,,,,,,,,,,,,,,,,,,, +[F0003],[I0021],,,,,,,,,,,,,,,,,,,, +[F0003],[I0008],,,,,,,,,,,,,,,,,,,, +[F0003],[I0015],,,,,,,,,,,,,,,,,,,, +[F0003],[I0020],,,,,,,,,,,,,,,,,,,, +[F0003],[I0010],,,,,,,,,,,,,,,,,,,, +Z5,X42,,,,,,,,,,,,,,,,,,,, +[F0006],[I0018],,,,,,,,,,,,,,,,,,,, +[F0006],[I0014],,,,,,,,,,,,,,,,,,,, +[F0008],[I0019],,,,,,,,,,,,,,,,,,,, +[F0008],[I0001],,,,,,,,,,,,,,,,,,,, +[F0008],[I0029],,,,,,,,,,,,,,,,,,,, +[F0009],[I0033],,,,,,,,,,,,,,,,,,,, +[F0010],[I0035],,,,,,,,,,,,,,,,,,,, +[F0012],[I0040],,,,,,,,,,,,,,,,,,,, +[F0012],[I0037],,,,,,,,,,,,,,,,,,,, +[F0013],[I0005],,,,,,,,,,,,,,,,,,,, +[F0013],[I0002],,,,,,,,,,,,,,,,,,,, +Z5,X43,,,,,,,,,,,,,,,,,,,, diff --git a/data/tests/imp_sample_csv.gramps b/data/tests/imp_sample_csv.gramps index c60251515..295715bae 100644 --- a/data/tests/imp_sample_csv.gramps +++ b/data/tests/imp_sample_csv.gramps @@ -3,7 +3,7 @@ "http://gramps-project.org/xml/1.7.1/grampsxml.dtd">
- + Paul Culley 11210 Olde Mint House Ln @@ -15,397 +15,402 @@
- + Birth - + Birth - + Death - + - + Birth - + Birth - + Birth - + Death - + - + Birth - + - + Death - + Birth - + - + Birth - + Death - + Birth - + Death - + - + Birth - + Birth - + Death - + Birth - + - + Death - + - + Birth - + Birth - + Birth - + Death - + - + Birth - + Death - + - + Birth - + Birth - + - + Birth - + Birth - + Birth - + Death - + - + Birth - + Death - + Birth - + Birth - + - + Death - + - + Burial - + - + - + Birth - + Death - + Birth - + Baptism - + - + Death - + - + Birth - + Birth - + Birth - + Birth - + Birth - + Birth - + Death - + - + Birth - + Birth - + Birth - + Death - + - + Birth - + Birth - + Birth - + Baptism - + Death - + Birth - + - + Death - + Birth - + Birth - + Death - + - + Birth - + + Birth + + + + Marriage - + Marriage - + Marriage - + Marriage - + Marriage - - Marriage - - - - + Marriage - + Marriage - + Marriage - + Marriage - + - + Marriage - + Marriage - + - + Marriage - + + + + Marriage + + - + F Janice Ann Adams - + - + F Jennifer @@ -413,27 +418,27 @@ - + - + F Marta Ericsdotter - + - + F Janis Elaine Green - + - + F Anna @@ -441,9 +446,9 @@ - + - + F Kerstina @@ -451,18 +456,18 @@ - + - + F Darcy Horne - + - + F Elna @@ -470,9 +475,9 @@ - + - + F Lillie Harriet @@ -480,632 +485,635 @@ - + - - M - - - Ke 柯 - - - - + F Evelyn Michaels - - + + - + M Herman Julius Nielsen + - - + - + F Marjorie Ohman + - - + - + F Alice Paula Perkins - - + + - + F Amber Marie Smith - - + + - + F Astrid Shermanna Augusta Smith + - - - + + - + M Carl Emil Smith + - - + - + M Craig Peter Smith - - + + - + M Edwin Michael Smith - - - + + + - + M Emil Smith - - + + - + M Eric Lloyd Smith Dr. - - - + + + - + M Gus Smith + - - - + + - + M Gustaf Smith Sr. + - - - + + - + F Hanna Smith - - + + - + M Hans Peter Smith + - - - - - + + + + - + M Hjalmar Smith + - - + - + M Hjalmar Smith + - - - + + - + F Ingar Smith - - + + - + M Ingeman Smith - - + + - + M Ingeman Smith - - + + - + M John Hjalmar Smith - - - + + + - + M Keith Lloyd Smith - - + + - + F Kirsti Marie Smith + - - - + + - + M Lars Peter Smith - - + + - + M Lloyd Smith - - - + + + - + M Magnes Smith + - - - + + - + F Marjorie Alice Smith - - + + - + F Marjorie Lee Smith - - + + - + M Martin Smith + - - - + + - + M Martin Smith + - - - + + - + M Mason Michael Smith - - + + - + F Anna Streiffert + - - + - + M Edwin Willard - - + + - + + M + + + Ke 柯 + + + + + M ピーター リチミシキスイミ + - + - + - - - - - + + + + + - + - + - - + + - + - + - - - - + + + + - + - + - - - - - - - - + + + + + + + + - + - - - + + + - + - - - - + + + + + - + - - - - - + + + - + - - - - - - - + - - - - + + + + - + - + - + - + - + - - + + - + - - - + + + - + - - - - - + + + + + - + - + - - - + + + - + - + + + + + + + + + - + 2 - + - + 2 - + - + 2 - + - + 2 - + - + Birth, Death and Marriage Records - + Birth Records - + findagrave.com - + Marriage Certificae - + Löderup, Malmöhus Län, Sweden - + Sparks, Washoe Co., NV - + San Francisco, San Francisco Co., CA - + Rønne, Bornholm, Denmark - + Gladsax, Kristianstad Län, Sweden - + Reno, Washoe Co., NV - + Hayward, Alameda Co., CA - + Community Presbyterian Church, Danville, CA - + Sweden - + Grostorp, Kristianstad Län, Sweden - + Copenhagen, Denmark - + Hoya/Jona/Hoia, Sweden - + Simrishamn, Kristianstad Län, Sweden - + Fremont, Alameda Co., CA - + Santa Rosa, Sonoma Co., CA - + San Jose, Santa Clara Co., CA - - UC Berkeley - - - + Smestorp, Kristianstad Län, Sweden - + Tommarp, Kristianstad Län, Sweden - + Rønne Bornholm, Denmark - + Woodland, Yolo Co., CA - + San Ramon, Conta Costa Co., CA - + United States of America - + California, USA - + - + Colorado, USA - + - + Sacramento Co., California, USA - + - + Sacramento, Sacramento Co., CA - + - + Denver Co., Colorado, USA - + - + Denver, Denver Co., CO - + + + + UC Berkeley +
From a9a259ebd0485d215ebf1571a94731769e4f6c9d Mon Sep 17 00:00:00 2001 From: prculley Date: Tue, 6 Sep 2016 10:10:47 -0500 Subject: [PATCH 3/3] Put back Titlecase versions of strings to be translated --- gramps/plugins/importer/importcsv.py | 44 +++++++++++++++------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/gramps/plugins/importer/importcsv.py b/gramps/plugins/importer/importcsv.py index b8c57d8a8..0dee09497 100644 --- a/gramps/plugins/importer/importcsv.py +++ b/gramps/plugins/importer/importcsv.py @@ -154,19 +154,21 @@ class CSVParser: self.place_types[custom_type] = 0 self.place_types[custom_type.lower()] = 0 column2label = { - "surname": ("lastname", "last_name", "surname", _("surname")), + "surname": ("lastname", "last_name", "surname", _("surname"), + _("Surname")), "firstname": ("firstname", "first_name", "given_name", "given", - "given name", _("given name"), _("given")), + "given name", _("given name"), _("given"), + _("Given"), _("Given name")), "callname": ("call name", _("Call name"), "callname", "call_name", - "call", _("call")), + "call", _("Call"), _("call")), "title": ("title", _("title"), _("Person or Place|title")), - "prefix": ("prefix", _("prefix")), - "suffix": ("suffix", _("suffix")), - "gender": ("gender", _("gender")), - "source": ("source", _("source")), - "note": ("note", _("note")), + "prefix": ("prefix", _("prefix"), _("Prefix")), + "suffix": ("suffix", _("suffix"), _("Suffix")), + "gender": ("gender", _("gender"), _("Gender")), + "source": ("source", _("source"), _("Source")), + "note": ("note", _("note"), _("Note")), "birthplace": ("birthplace", "birth_place", "birth place", - _("birth place")), + _("birth place"), _("Birth place")), "birthplace_id": ("birthplaceid", "birth_place_id", "birth place id", _("birth place id"), "birthplace_id"), @@ -202,24 +204,26 @@ class CSVParser: _("death cause")), "grampsid": (_("Gramps ID"), "grampsid", "id", "gramps_id", "gramps id"), - "person": ("person", _("person")), + "person": ("person", _("person"), _("Person")), # ---------------------------------- - "child": ("child", _("child")), - "family": ("family", _("family")), + "child": ("child", _("child"), _("Child")), + "family": ("family", _("family"), _("Family")), # ---------------------------------- - "wife": ("mother", _("mother"), "wife", _("wife"), + "wife": ("mother", _("mother"), _("Mother"), + "wife", _("wife"), _("Wife"), "parent2", _("parent2")), - "husband": ("father", _("father"), "husband", _("husband"), + "husband": ("father", _("father"), _("Father"), + "husband", _("husband"), _("Husband"), "parent1", _("parent1")), - "marriage": ("marriage", _("marriage")), - "date": ("date", _("date")), - "place": ("place", _("place")), + "marriage": ("marriage", _("marriage"), _("Marriage")), + "date": ("date", _("date"), _("Date")), + "place": ("place", _("place"), _("Place")), "place_id": ("place id", "place_id", "placeid", _("place id")), - "name": ("name", _("name")), - "type": ("type", _("type")), + "name": ("name", _("name"), _("Name")), + "type": ("type", _("type"), _("Type")), "latitude": ("latitude", _("latitude")), "longitude": ("longitude", _("longitude")), - "code": ("code", _("code")), + "code": ("code", _("code"), _("Code")), "enclosed_by": ("enclosed by", _("enclosed by"), "enclosed_by", _("enclosed_by"), "enclosedby") }