Skip to content

Commit

Permalink
MIR-1226 added missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
sebhofmann authored and xaher committed Aug 30, 2023
1 parent bfa0fb9 commit 1178bc8
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
68 changes: 68 additions & 0 deletions mir-module/src/main/resources/config/mir/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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/";
Expand Down Expand Up @@ -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<SearchResult | null> {
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<SearchResult | null> {
const result: Name = {
"type": "Name",
"nameType": "corporate",
Expand All @@ -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<SearchResult | null> {
const result: Name = {
"type": "Name",
"nameType": "personal",
Expand Down Expand Up @@ -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(", ")
});
}
Expand All @@ -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(", ")
});
}
Expand All @@ -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) {
Expand All @@ -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<SearchResultInfo>) {
async addVariantName(member: any, info: Array<SearchResultInfo>) {
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<SearchResultInfo>) {
async addWebsiteIfPresent(member: any, info: Array<SearchResultInfo>) {
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<SearchResultInfo>) {
async addGNDLink(member: any, info: Array<SearchResultInfo>) {
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,
})
}
Expand All @@ -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;
}
Expand All @@ -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,
Expand All @@ -280,24 +274,27 @@ export class LobidSearchProvider extends SearchProvider {
info: [] as Array<SearchResultInfo>
}

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,
Expand All @@ -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;
}
Expand All @@ -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],
Expand All @@ -345,8 +342,8 @@ export class LobidSearchProvider extends SearchProvider {
info: [] as Array<SearchResultInfo>
}

this.addVariantName(member, searchResult.info);
this.addWebsiteIfPresent(member, searchResult.info);
await this.addVariantName(member, searchResult.info);
await this.addWebsiteIfPresent(member, searchResult.info);



Expand Down

0 comments on commit 1178bc8

Please sign in to comment.