Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions scripts/normalize-xlf.prebuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,12 @@ function normalizeXlf12Sources(path: string) {
'printView.couldNotLoad',
'printView.activityGroupHeading',
'printView.peerReviewHeading',
'printView.printSaveAsPdf',
'printView.printThisOrcidProfile',
'printView.relSelf',
'printView.relPartOf',
'printView.relVersionOf',
'printView.relFundedBy',
]
const PRINT_VIEW_SOURCES: Record<string, string> = {
'printView.unnamedProfile': 'Unnamed ORCID profile',
Expand Down Expand Up @@ -174,6 +180,12 @@ function normalizeXlf12Sources(path: string) {
'printView.couldNotLoad': 'Could not load',
'printView.activityGroupHeading': 'Activity group heading',
'printView.peerReviewHeading': 'Peer review heading',
'printView.printSaveAsPdf': 'Print / Save as PDF',
'printView.printThisOrcidProfile': 'Print this ORCID profile',
'printView.relSelf': 'Self',
'printView.relPartOf': 'Part of',
'printView.relVersionOf': 'Version of',
'printView.relFundedBy': 'Funded by',
}
const existingIds = new Set(transUnits.map((tu: any) => tu?.$?.id))
const printViewBody = fileNode?.body?.[0]
Expand Down
2 changes: 1 addition & 1 deletion src/assets/print-view/cv-style.css
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ button:hover {
}

.orcid-id {
margin-top: 8px;
margin-top: 12px;
display: flex;
align-items: center;
gap: 8px;
Expand Down
42 changes: 30 additions & 12 deletions src/assets/print-view/fetch-orcid.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ const STRINGS = {
recordNotFound: $localize`:@@printView.recordNotFound:Record data was not found in ORCID response.`,
redirectingToPrimary: $localize`:@@printView.redirectingToPrimary:Redirecting to primary ORCID record…`,
orcidPrintView: $localize`:@@printView.orcidPrintView:ORCID Print view`,
printSaveAsPdf: $localize`:@@printView.printSaveAsPdf:Print / Save as PDF`,
printThisOrcidProfile: $localize`:@@printView.printThisOrcidProfile:Print this ORCID profile`,
relSelf: $localize`:@@printView.relSelf:Self`,
relPartOf: $localize`:@@printView.relPartOf:Part of`,
relVersionOf: $localize`:@@printView.relVersionOf:Version of`,
relFundedBy: $localize`:@@printView.relFundedBy:Funded by`,
}

const ORCID_REGEX = /\b\d{4}-\d{4}-\d{4}-\d{3}[\dX]\b/i
Expand Down Expand Up @@ -600,9 +606,19 @@ function composeActivityEntryFromJson(entry, opts = {}) {
const idValue = jsonText(id.value || id['external-id-value'])
const idRel = jsonText(id.relationship || id['external-id-relationship'])
const idUrl = sanitizeUrl(jsonText(id['external-id-url']?.value))

let localizedRel = idRel
if (idRel) {
const lowerRel = idRel.toLowerCase()
if (lowerRel === 'self') localizedRel = STRINGS.relSelf
else if (lowerRel === 'part-of') localizedRel = STRINGS.relPartOf
else if (lowerRel === 'version-of') localizedRel = STRINGS.relVersionOf
else if (lowerRel === 'funded-by') localizedRel = STRINGS.relFundedBy
}

const label =
idRel && idRel.toLowerCase() !== 'self'
? `${idRel} ${idType}`
? `${localizedRel} ${idType}`.trim()
: idType || STRINGS.identifier
wrapper.appendChild(
otherIdsTextNode(label, idValue || idUrl || '', idUrl)
Expand Down Expand Up @@ -862,17 +878,17 @@ function renderPeerReviews(activities, section) {
// Peer reviews: activities.peer-reviews.group.peer-review-group
for (const group of activities?.['peer-reviews']?.group || []) {
for (const peerReviewGroup of group['peer-review-group'] || []) {
for (const peerReviewSummary of peerReviewGroup['peer-review-summary'] ||
[]) {
reviews++
const publication = peerReviewSummary['review-group-id']
if (publications.has(publication)) {
const count = peerReviewsPerPublication.get(publication)
peerReviewsPerPublication.set(publication, count + 1)
} else {
publications.add(publication)
peerReviewsPerPublication.set(publication, 1)
}
// Just process the first peer review element on each group
const firstPeerReviewSummary = peerReviewGroup['peer-review-summary'][0]
const numOfReviewsInGroup = peerReviewGroup['peer-review-summary'].length
reviews += numOfReviewsInGroup
const publication = firstPeerReviewSummary['review-group-id']
if (publications.has(publication)) {
const count = peerReviewsPerPublication.get(publication)
peerReviewsPerPublication.set(publication, count + 1)
} else {
publications.add(publication)
peerReviewsPerPublication.set(publication, 1)
}
}
}
Expand Down Expand Up @@ -1002,6 +1018,8 @@ async function loadRecord(orcidId) {
// This allows the file to be loaded in test environments (Karma/Jasmine) where
// the print-view HTML is not present and getElementById returns null.
if (cvRoot && statusNode && printButton) {
printButton.textContent = STRINGS.printSaveAsPdf
printButton.setAttribute('aria-label', STRINGS.printThisOrcidProfile)
printButton.addEventListener('click', () => window.print())

const startingId = resolveOrcidIdFromLocation()
Expand Down
5 changes: 1 addition & 4 deletions src/assets/print-view/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@
<button
id="print-button"
type="button"
aria-label="Print this ORCID profile"
>
Print / Save as PDF
</button>
></button>
</header>

<div
Expand Down
70 changes: 39 additions & 31 deletions src/locale/messages.lr.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
<x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong>"/>
<x id="INTERPOLATION" equiv-text="{{ orcidToDeprecate }}"/>
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&lt;/strong&#xA; >"/>
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&lt;/strong&#xD;&#xA; >"/>
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span>"/>
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
</source>
Expand Down Expand Up @@ -1202,8 +1202,8 @@
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span>"/>
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
<x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong>"/>
<x id="INTERPOLATION" equiv-text="ount&#xA; }}"/>
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&amp;n"/>
<x id="INTERPOLATION" equiv-text="count&#xD;&#xA; }}"/>
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&amp;"/>
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span>"/>
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
</source>
Expand All @@ -1219,8 +1219,8 @@
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span>"/>
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
<x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong>"/>
<x id="INTERPOLATION" equiv-text="ount&#xA; }}"/>
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&amp;n"/>
<x id="INTERPOLATION" equiv-text="count&#xD;&#xA; }}"/>
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&amp;"/>
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span>"/>
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
</source>
Expand Down Expand Up @@ -17166,11 +17166,11 @@
<context context-type="linenumber">12,14</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
<context context-type="linenumber">18,20</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
<context context-type="linenumber">18,20</context>
</context-group>
<context-group purpose="location">
Expand All @@ -17190,11 +17190,11 @@
<context context-type="linenumber">20,22</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
<context context-type="linenumber">26,28</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
<context context-type="linenumber">26,28</context>
</context-group>
<context-group purpose="location">
Expand Down Expand Up @@ -17253,14 +17253,14 @@
<context context-type="sourcefile">src/app/register/components/step-b/step-b.component.html</context>
<context context-type="linenumber">46</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
<context context-type="linenumber">52</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
<context context-type="linenumber">56</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
<context context-type="linenumber">52</context>
</context-group>
<target>LR</target>
</trans-unit>
<trans-unit id="register.cancelRegistration" datatype="html" resname="register.cancelRegistration">
Expand Down Expand Up @@ -17295,46 +17295,46 @@
</context-group>
<target>LR</target>
</trans-unit>
<trans-unit id="register.step4.3" datatype="html" resname="register.step4.3">
<source>Step 4 of 5 - Visibility</source>
<trans-unit id="register.step3.3" datatype="html" resname="register.step3.3">
<source>Step 3 of 5 - Current employment</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
<context context-type="linenumber">32,34</context>
</context-group>
<target>LR</target>
</trans-unit>
<trans-unit id="shared.previousStep" datatype="html" resname="shared.previousStep">
<source>Previous Step</source>
<trans-unit id="shared.skipThisStepWithoutAddingAnAffiliation" datatype="html" resname="shared.skipThisStepWithoutAddingAnAffiliation">
<source>Skip this step without adding an affiliation</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
<context context-type="linenumber">62</context>
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
<context context-type="linenumber">68,69</context>
</context-group>
<target>LR</target>
</trans-unit>
<trans-unit id="shared.previousStep" datatype="html" resname="shared.previousStep">
<source>Previous Step</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
<context context-type="linenumber">80</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
<context context-type="linenumber">62</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-d/step-d.component.html</context>
<context context-type="linenumber">75</context>
</context-group>
<target>LR</target>
</trans-unit>
<trans-unit id="register.step3.3" datatype="html" resname="register.step3.3">
<source>Step 3 of 5 - Current employment</source>
<trans-unit id="register.step4.3" datatype="html" resname="register.step4.3">
<source>Step 4 of 5 - Visibility</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
<context context-type="linenumber">32,34</context>
</context-group>
<target>LR</target>
</trans-unit>
<trans-unit id="shared.skipThisStepWithoutAddingAnAffiliation" datatype="html" resname="shared.skipThisStepWithoutAddingAnAffiliation">
<source>Skip this step without adding an affiliation</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
<context context-type="linenumber">68,69</context>
</context-group>
<target>LR</target>
</trans-unit>
<trans-unit id="register.step5.3" datatype="html" resname="register.step5.3">
<source>Step 5 of 5 - Terms and conditions</source>
<context-group purpose="location">
Expand Down Expand Up @@ -21308,6 +21308,14 @@
<source>Peer review heading</source>
<target>LR</target>
</trans-unit>
<trans-unit id="printView.printSaveAsPdf" datatype="html" resname="printView.printSaveAsPdf">
<source>Print / Save as PDF</source>
<target>LR</target>
</trans-unit>
<trans-unit id="printView.printThisOrcidProfile" datatype="html" resname="printView.printThisOrcidProfile">
<source>Print this ORCID profile</source>
<target>LR</target>
</trans-unit>
</body>
</file>
</xliff>
Loading
Loading