From 1178bc8bc15a7728cce6f9638c13b03326c7c9c9 Mon Sep 17 00:00:00 2001 From: Sebastian Hofmann Date: Mon, 24 Jul 2023 12:00:21 +0200 Subject: [PATCH] MIR-1226 added missing translations --- .../config/mir/messages_de.properties | 9 ++ .../config/mir/messages_en.properties | 68 +++++++++++ .../src/api/search/LobidSearchProvider.ts | 115 +++++++++--------- 3 files changed, 133 insertions(+), 59 deletions(-) diff --git a/mir-module/src/main/resources/config/mir/messages_de.properties b/mir-module/src/main/resources/config/mir/messages_de.properties index 0a986253f3..7ca82c22bf 100644 --- a/mir-module/src/main/resources/config/mir/messages_de.properties +++ b/mir-module/src/main/resources/config/mir/messages_de.properties @@ -164,6 +164,15 @@ mir.editor.subject.cartographics.display.coordinates = Koordinaten mir.editor.subject.cartographics.display.scale = Ma\u00DFstab mir.editor.subject.cartographics.display.showMap = Karte anzeigen mir.editor.subject.cartographics.display.showAllCoordinates= Alle Koordinaten anzeigen +mir.editor.subject.provider.corporateBody.dateOfEstablishment = Gr\u00FCndungsjahr +mir.editor.subject.provider.person.dateOfBirth = Geburtsjahr +mir.editor.subject.provider.person.dateOfDeath = Sterbejahr +mir.editor.subject.provider.person.profession = Beruf +mir.editor.subject.provider.variantName = Namensvarianten +mir.editor.subject.provider.website = Webseite +mir.editor.subject.provider.gndLink = GND-Link +mir.editor.subject.provider.place.biographicalOrHistoricalInformation = Biographische oder historische Informationen + mir.subject.bagde.gnd = GND mir.subject.bagde.lcsh = LCSH diff --git a/mir-module/src/main/resources/config/mir/messages_en.properties b/mir-module/src/main/resources/config/mir/messages_en.properties index 508761f1d4..d9956f0e07 100644 --- a/mir-module/src/main/resources/config/mir/messages_en.properties +++ b/mir-module/src/main/resources/config/mir/messages_en.properties @@ -100,6 +100,74 @@ mir.editor.person.link = Link mir.editor.person.wikipedia = Wikipedia mir.editor.addIdentifier = Add Identifier +mir.editor.subject.search = Search +mir.editor.subject.search.modal.title = Search Results +mir.editor.subject.search.modal.close = Close +mir.editor.subject.search.result.add = Add +mir.editor.subject.search.options.persons = search for persons +mir.editor.subject.search.options.institutions = search for institutions +mir.editor.subject.search.options.families = search for families +mir.editor.subject.search.options.conferences = search for conferences +mir.editor.subject.search.options.topics = search for topics +mir.editor.subject.search.options.places = search for places +mir.editor.subject.search.options.titles = search for titles +mir.editor.subject.custom.modal.title = own subject +mir.editor.subject.custom.modal.type = Subject Type +mir.editor.subject.custom.modal.type.Topic = Topic +mir.editor.subject.custom.modal.type.Geographic = Geographic +mir.editor.subject.custom.modal.type.Institution = Institution +mir.editor.subject.custom.modal.type.Person = Person +mir.editor.subject.custom.modal.type.Family = Family +mir.editor.subject.custom.modal.type.Conference = Conference +mir.editor.subject.custom.modal.type.TitleInfo = Title +mir.editor.subject.custom.modal.type.Cartographics = Cartographics +mir.editor.subject.custom.modal.close = Close +mir.editor.subject.custom.modal.add = Add +mir.editor.subject.editor.language = Language +mir.editor.subject.editor.language.choose = Choose a language +mir.editor.subject.topic.editor.topic = Topic +mir.editor.subject.topic.editor.invalid.topic = please enter a valid topic +mir.editor.subject.name.editor.displayForm = Display Form +mir.editor.subject.name.editor.invalid.displayForm = please enter a valid display form +mir.editor.subject.name.editor.namePart = Name Part +mir.editor.subject.name.editor.invalid.namePart = please enter a valid name part +mir.editor.subject.name.editor.namePart.type.given = given name +mir.editor.subject.name.editor.namePart.type.family = family name +mir.editor.subject.name.editor.namePart.Type.date = date +mir.editor.subject.name.editor.namePart.Type.termsOfAddress = terms of address +mir.editor.subject.name.editor.identifier = Identifier +mir.editor.subject.name.editor.invalid.identifier = please enter a valid identifier +mir.editor.subject.name.editor.affiliation = Affiliation +mir.editor.subject.name.editor.invalid.affiliation = please enter a valid affiliation +mir.editor.subject.titleInfo.editor.title = Title +mir.editor.subject.titleInfo.editor.invalid.title = please enter a valid title +mir.editor.subject.titleInfo.editor.subtitle = Subtitle +mir.editor.subject.titleInfo.editor.invalid.subtitle = please enter a valid subtitle +mir.editor.subject.titleInfo.editor.partNumber = Part Number +mir.editor.subject.titleInfo.editor.invalid.partNumber = please enter a valid part number +mir.editor.subject.titleInfo.editor.partName = Part Name +mir.editor.subject.titleInfo.editor.invalid.partName = please enter a valid part name +mir.editor.subject.cartographics.editor.scale = Scale +mir.editor.subject.cartographics.editor.invalid.scale = please enter a valid scale +mir.editor.subject.cartographics.editor.coordinates = Coordinates +mir.editor.subject.cartographics.editor.invalid.coordinates= please enter valid coordinates +mir.editor.subject.cartographics.editor.add.point = Add Point +mir.editor.subject.cartographics.editor.add.polygon = Add Polygon +mir.editor.subject.geographic.editor.name = Name +mir.editor.subject.geographic.editor.invalid.name = please enter a valid name +mir.editor.subject.cartographics.display.coordinates = Coordinates +mir.editor.subject.cartographics.display.scale = Scale +mir.editor.subject.cartographics.display.showMap = Show Map +mir.editor.subject.cartographics.display.showAllCoordinates= Show all coordinates +mir.editor.subject.provider.corporateBody.dateOfEstablishment = Date of Establishment +mir.editor.subject.provider.person.dateOfBirth = Date of Birth +mir.editor.subject.provider.person.dateOfDeath = Date of Death +mir.editor.subject.provider.person.profession = Profession +mir.editor.subject.provider.variantName = Variant Name +mir.editor.subject.provider.website = Website +mir.editor.subject.provider.gndLink = GND Link +mir.editor.subject.provider.place.biographicalOrHistoricalInformation = Biographical or Historical Information + img.alt.search.complex = complex search img.alt.search.simple = simple search diff --git a/mir-webapp/src/main/vue/editor-tools/src/api/search/LobidSearchProvider.ts b/mir-webapp/src/main/vue/editor-tools/src/api/search/LobidSearchProvider.ts index a2b08715f4..78d096ec50 100644 --- a/mir-webapp/src/main/vue/editor-tools/src/api/search/LobidSearchProvider.ts +++ b/mir-webapp/src/main/vue/editor-tools/src/api/search/LobidSearchProvider.ts @@ -1,15 +1,7 @@ import {SearchSettings} from "@/api/search/SearchSettings"; -import { - Cartographics, - Genre, - Geographic, GeographicCode, - HierarchicalGeographic, - Name, NameIdentifier, Occupation, RoleTerm, - Temporal, - TitleInfo, - Topic -} from "@/api/Subject"; +import {Geographic, Name, NameIdentifier, RoleTerm, TitleInfo, Topic} from "@/api/Subject"; import {SearchProvider, SearchResult, SearchResultInfo} from "@/api/search/SearchProvider"; +import {i18n} from "@/api/I18N"; const VIAF_ID_PREFIX_1 = "http://viaf.org/viaf/"; const VIAF_ID_PREFIX_2 = "https://viaf.org/viaf/"; @@ -59,50 +51,50 @@ export class LobidSearchProvider extends SearchProvider { const response = await fetch(url); const json = await response.json(); - json.member.forEach((member: any) => { - const memberResult = this.handleMember(member); + for (const member of json.member) { + const memberResult = await this.handleMember(member); if (memberResult != null) { result.push(memberResult); } - }); + } return result; } - handleMember(member: any): SearchResult | null { + async handleMember(member: any): Promise { if (member.type.indexOf("CorporateBody") > -1) { - return this.handleCorporateBody(member); + return await this.handleCorporateBody(member); } if (member.type.indexOf("Person") > -1) { - return this.handlePerson(member); + return await this.handlePerson(member); } if (member.type.indexOf("Family") > -1) { - return this.handleFamily(member); + return await this.handleFamily(member); } if (member.type.indexOf("ConferenceOrEvent") > -1) { - return this.handleConference(member); + return await this.handleConference(member); } if (member.type.indexOf("PlaceOrGeographicName") > -1) { - return this.handlePlace(member); + return await this.handlePlace(member); } if (member.type.indexOf("SubjectHeading") > -1) { - return this.handleTopic(member); + return await this.handleTopic(member); } if (member.type.indexOf("Work") > -1) { - return this.handleTitle(member); + return await this.handleTitle(member); } return null; } - handleCorporateBody(member: any): SearchResult | null { + async handleCorporateBody(member: any): Promise { const result: Name = { "type": "Name", "nameType": "corporate", @@ -129,18 +121,18 @@ export class LobidSearchProvider extends SearchProvider { searchResult.info.push({ "id": this.generateID(), "type": "string", - "label": "mir.editor.corporateBody.dateOfEstablishment", + "label": await i18n("mir.editor.subject.provider.corporateBody.dateOfEstablishment"), "value": member.dateOfEstablishment }); } - this.addGNDLink(member, searchResult.info); + await this.addGNDLink(member, searchResult.info); return searchResult; } - private handlePerson(member: any): SearchResult | null { + async handlePerson(member: any): Promise { const result: Name = { "type": "Name", "nameType": "personal", @@ -168,7 +160,7 @@ export class LobidSearchProvider extends SearchProvider { searchResult.info.push({ id: this.generateID(), type: "string", - label: "mir.editor.person.dateOfBirth", + label: await i18n("mir.editor.subject.provider.person.dateOfBirth"), value: member.dateOfBirth.join(", ") }); } @@ -177,7 +169,7 @@ export class LobidSearchProvider extends SearchProvider { searchResult.info.push({ id: this.generateID(), type: "string", - label: "mir.editor.person.dateOfDeath", + label: await i18n("mir.editor.subject.provider.person.dateOfDeath"), value: member.dateOfDeath.join(", ") }); } @@ -194,7 +186,7 @@ export class LobidSearchProvider extends SearchProvider { } } } - this.addVariantName(member, searchResult.info); + (await this.addVariantName(member, searchResult.info)); const professionCollector: string[] = []; for (const professionIndex in member.professionOrOccupation) { @@ -205,48 +197,50 @@ export class LobidSearchProvider extends SearchProvider { } if (professionCollector.length > 0) { searchResult.info.push({ - label: "mir.editor.person.profession", + label: await i18n("mir.editor.subject.provider.person.profession"), value: professionCollector.join(", "), id: this.generateID(), type: "string" }); } - this.addWebsiteIfPresent(member, searchResult.info); - this.addGNDLink(member, searchResult.info); + await this.addWebsiteIfPresent(member, searchResult.info); + await this.addGNDLink(member, searchResult.info); return searchResult; } - private addVariantName(member: any, info: Array) { + async addVariantName(member: any, info: Array) { if ("variantName" in member) { info.push({ id: this.generateID(), type: "string", - label: "mir.editor.variantName", + label: await i18n("mir.editor.subject.provider.variantName"), value: (member.variantName as string[]).join(", ") }); } } - private addWebsiteIfPresent(member: any, info: Array) { + async addWebsiteIfPresent(member: any, info: Array) { if ("homepage" in member) { - (member.homepage as { id: string; label: string }[]).map(hp => hp.id).forEach((url: string) => { + const urls = (member.homepage as { id: string; label: string }[]).map(hp => hp.id); + for (let i = 0; i < urls.length; i++){ + const url: string = urls[i]; info.push({ id: this.generateID(), type: "url", - label: "mir.editor.person.website", + label: await i18n("mir.editor.subject.provider.website"), value: url, }) - }); + } } } - private addGNDLink(member: any, info: Array) { + async addGNDLink(member: any, info: Array) { if("id" in member) { info.push({ id: this.generateID(), type: "url", - label: "mir.editor.person.gndLink", + label: await i18n( "mir.editor.subject.provider.gndLink"), value: member.id, }) } @@ -256,8 +250,8 @@ export class LobidSearchProvider extends SearchProvider { return Math.random().toString(16); } - private handleConference(member: any) { - const conference = this.handleCorporateBody(member); + async handleConference(member: any) { + const conference = await this.handleCorporateBody(member); if (conference == null) { return null; } @@ -266,7 +260,7 @@ export class LobidSearchProvider extends SearchProvider { return conference; } - private handlePlace(member: any) { + async handlePlace(member: any) { const result: Geographic = { "type": "Geographic", text: member.preferredName, @@ -280,24 +274,27 @@ export class LobidSearchProvider extends SearchProvider { info: [] as Array } - this.addWebsiteIfPresent(member, searchResult.info); - this.addVariantName(member, searchResult.info); + await this.addWebsiteIfPresent(member, searchResult.info); + await this.addVariantName(member, searchResult.info); + + if("biographicalOrHistoricalInformation" in member && member.biographicalOrHistoricalInformation.length > 0){ + for (const bio of member.biographicalOrHistoricalInformation) { + searchResult.info.push({ + id: this.generateID(), + type: "string", + label: await i18n("mir.editor.subject.provider.place.biographicalOrHistoricalInformation"), + value: bio + }); + } + } - member.biographicalOrHistoricalInformation?.forEach((bio: string) => { - searchResult.info.push({ - id: this.generateID(), - type: "string", - label: "mir.editor.place.biographicalOrHistoricalInformation", - value: bio - }); - }); - this.addGNDLink(member, searchResult.info); + await this.addGNDLink(member, searchResult.info); return searchResult; } - private handleTopic(member: any) { + async handleTopic(member: any) { const result: Topic = { "type": "Topic", text: member.preferredName, @@ -314,8 +311,8 @@ export class LobidSearchProvider extends SearchProvider { return searchResult; } - private handleFamily(member: any) { - const handlePerson = this.handlePerson(member); + async handleFamily(member: any) { + const handlePerson = await this.handlePerson(member); if(handlePerson == null) { return null; } @@ -325,7 +322,7 @@ export class LobidSearchProvider extends SearchProvider { return handlePerson; } - private handleTitle(member: any) { + async handleTitle(member: any) { const result: TitleInfo = { "type": "TitleInfo", title: [member.preferredName], @@ -345,8 +342,8 @@ export class LobidSearchProvider extends SearchProvider { info: [] as Array } - this.addVariantName(member, searchResult.info); - this.addWebsiteIfPresent(member, searchResult.info); + await this.addVariantName(member, searchResult.info); + await this.addWebsiteIfPresent(member, searchResult.info);