Skip to content

Commit c613190

Browse files
authored
Merge pull request #2864 from ORCID/amontenegro/PD-5754
{PD-5754} {PD-5756} {PD-5755} Amontenegro/pd 5754
2 parents 6d288ae + a8a8b2b commit c613190

8 files changed

Lines changed: 197 additions & 140 deletions

File tree

scripts/normalize-xlf.prebuild.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ function normalizeXlf12Sources(path: string) {
129129
'printView.couldNotLoad',
130130
'printView.activityGroupHeading',
131131
'printView.peerReviewHeading',
132+
'printView.printSaveAsPdf',
133+
'printView.printThisOrcidProfile',
134+
'printView.relSelf',
135+
'printView.relPartOf',
136+
'printView.relVersionOf',
137+
'printView.relFundedBy',
132138
]
133139
const PRINT_VIEW_SOURCES: Record<string, string> = {
134140
'printView.unnamedProfile': 'Unnamed ORCID profile',
@@ -174,6 +180,12 @@ function normalizeXlf12Sources(path: string) {
174180
'printView.couldNotLoad': 'Could not load',
175181
'printView.activityGroupHeading': 'Activity group heading',
176182
'printView.peerReviewHeading': 'Peer review heading',
183+
'printView.printSaveAsPdf': 'Print / Save as PDF',
184+
'printView.printThisOrcidProfile': 'Print this ORCID profile',
185+
'printView.relSelf': 'Self',
186+
'printView.relPartOf': 'Part of',
187+
'printView.relVersionOf': 'Version of',
188+
'printView.relFundedBy': 'Funded by',
177189
}
178190
const existingIds = new Set(transUnits.map((tu: any) => tu?.$?.id))
179191
const printViewBody = fileNode?.body?.[0]

src/assets/print-view/cv-style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ button:hover {
137137
}
138138

139139
.orcid-id {
140-
margin-top: 8px;
140+
margin-top: 12px;
141141
display: flex;
142142
align-items: center;
143143
gap: 8px;

src/assets/print-view/fetch-orcid.js

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ const STRINGS = {
5555
recordNotFound: $localize`:@@printView.recordNotFound:Record data was not found in ORCID response.`,
5656
redirectingToPrimary: $localize`:@@printView.redirectingToPrimary:Redirecting to primary ORCID record…`,
5757
orcidPrintView: $localize`:@@printView.orcidPrintView:ORCID Print view`,
58+
printSaveAsPdf: $localize`:@@printView.printSaveAsPdf:Print / Save as PDF`,
59+
printThisOrcidProfile: $localize`:@@printView.printThisOrcidProfile:Print this ORCID profile`,
60+
relSelf: $localize`:@@printView.relSelf:Self`,
61+
relPartOf: $localize`:@@printView.relPartOf:Part of`,
62+
relVersionOf: $localize`:@@printView.relVersionOf:Version of`,
63+
relFundedBy: $localize`:@@printView.relFundedBy:Funded by`,
5864
}
5965

6066
const ORCID_REGEX = /\b\d{4}-\d{4}-\d{4}-\d{3}[\dX]\b/i
@@ -600,9 +606,19 @@ function composeActivityEntryFromJson(entry, opts = {}) {
600606
const idValue = jsonText(id.value || id['external-id-value'])
601607
const idRel = jsonText(id.relationship || id['external-id-relationship'])
602608
const idUrl = sanitizeUrl(jsonText(id['external-id-url']?.value))
609+
610+
let localizedRel = idRel
611+
if (idRel) {
612+
const lowerRel = idRel.toLowerCase()
613+
if (lowerRel === 'self') localizedRel = STRINGS.relSelf
614+
else if (lowerRel === 'part-of') localizedRel = STRINGS.relPartOf
615+
else if (lowerRel === 'version-of') localizedRel = STRINGS.relVersionOf
616+
else if (lowerRel === 'funded-by') localizedRel = STRINGS.relFundedBy
617+
}
618+
603619
const label =
604620
idRel && idRel.toLowerCase() !== 'self'
605-
? `${idRel} ${idType}`
621+
? `${localizedRel} ${idType}`.trim()
606622
: idType || STRINGS.identifier
607623
wrapper.appendChild(
608624
otherIdsTextNode(label, idValue || idUrl || '', idUrl)
@@ -862,17 +878,17 @@ function renderPeerReviews(activities, section) {
862878
// Peer reviews: activities.peer-reviews.group.peer-review-group
863879
for (const group of activities?.['peer-reviews']?.group || []) {
864880
for (const peerReviewGroup of group['peer-review-group'] || []) {
865-
for (const peerReviewSummary of peerReviewGroup['peer-review-summary'] ||
866-
[]) {
867-
reviews++
868-
const publication = peerReviewSummary['review-group-id']
869-
if (publications.has(publication)) {
870-
const count = peerReviewsPerPublication.get(publication)
871-
peerReviewsPerPublication.set(publication, count + 1)
872-
} else {
873-
publications.add(publication)
874-
peerReviewsPerPublication.set(publication, 1)
875-
}
881+
// Just process the first peer review element on each group
882+
const firstPeerReviewSummary = peerReviewGroup['peer-review-summary'][0]
883+
const numOfReviewsInGroup = peerReviewGroup['peer-review-summary'].length
884+
reviews += numOfReviewsInGroup
885+
const publication = firstPeerReviewSummary['review-group-id']
886+
if (publications.has(publication)) {
887+
const count = peerReviewsPerPublication.get(publication)
888+
peerReviewsPerPublication.set(publication, count + 1)
889+
} else {
890+
publications.add(publication)
891+
peerReviewsPerPublication.set(publication, 1)
876892
}
877893
}
878894
}
@@ -1002,6 +1018,8 @@ async function loadRecord(orcidId) {
10021018
// This allows the file to be loaded in test environments (Karma/Jasmine) where
10031019
// the print-view HTML is not present and getElementById returns null.
10041020
if (cvRoot && statusNode && printButton) {
1021+
printButton.textContent = STRINGS.printSaveAsPdf
1022+
printButton.setAttribute('aria-label', STRINGS.printThisOrcidProfile)
10051023
printButton.addEventListener('click', () => window.print())
10061024

10071025
const startingId = resolveOrcidIdFromLocation()

src/assets/print-view/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@
2020
<button
2121
id="print-button"
2222
type="button"
23-
aria-label="Print this ORCID profile"
24-
>
25-
Print / Save as PDF
26-
</button>
23+
></button>
2724
</header>
2825

2926
<div

src/locale/messages.lr.xlf

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -654,7 +654,7 @@
654654
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
655655
<x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong>"/>
656656
<x id="INTERPOLATION" equiv-text="{{ orcidToDeprecate }}"/>
657-
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&lt;/strong&#xA; >"/>
657+
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&lt;/strong&#xD;&#xA; >"/>
658658
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span>"/>
659659
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
660660
</source>
@@ -1202,8 +1202,8 @@
12021202
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span>"/>
12031203
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
12041204
<x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong>"/>
1205-
<x id="INTERPOLATION" equiv-text="ount&#xA; }}"/>
1206-
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&amp;n"/>
1205+
<x id="INTERPOLATION" equiv-text="count&#xD;&#xA; }}"/>
1206+
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&amp;"/>
12071207
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span>"/>
12081208
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
12091209
</source>
@@ -1219,8 +1219,8 @@
12191219
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span>"/>
12201220
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
12211221
<x id="START_TAG_STRONG" ctype="x-strong" equiv-text="&lt;strong>"/>
1222-
<x id="INTERPOLATION" equiv-text="ount&#xA; }}"/>
1223-
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&amp;n"/>
1222+
<x id="INTERPOLATION" equiv-text="count&#xD;&#xA; }}"/>
1223+
<x id="CLOSE_TAG_STRONG" ctype="x-strong" equiv-text="&amp;"/>
12241224
<x id="START_TAG_SPAN" ctype="x-span" equiv-text="&lt;span>"/>
12251225
<x id="CLOSE_TAG_SPAN" ctype="x-span" equiv-text="&lt;/span>"/>
12261226
</source>
@@ -17166,11 +17166,11 @@
1716617166
<context context-type="linenumber">12,14</context>
1716717167
</context-group>
1716817168
<context-group purpose="location">
17169-
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
17169+
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
1717017170
<context context-type="linenumber">18,20</context>
1717117171
</context-group>
1717217172
<context-group purpose="location">
17173-
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
17173+
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
1717417174
<context context-type="linenumber">18,20</context>
1717517175
</context-group>
1717617176
<context-group purpose="location">
@@ -17190,11 +17190,11 @@
1719017190
<context context-type="linenumber">20,22</context>
1719117191
</context-group>
1719217192
<context-group purpose="location">
17193-
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
17193+
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
1719417194
<context context-type="linenumber">26,28</context>
1719517195
</context-group>
1719617196
<context-group purpose="location">
17197-
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
17197+
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
1719817198
<context context-type="linenumber">26,28</context>
1719917199
</context-group>
1720017200
<context-group purpose="location">
@@ -17253,14 +17253,14 @@
1725317253
<context context-type="sourcefile">src/app/register/components/step-b/step-b.component.html</context>
1725417254
<context context-type="linenumber">46</context>
1725517255
</context-group>
17256-
<context-group purpose="location">
17257-
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
17258-
<context context-type="linenumber">52</context>
17259-
</context-group>
1726017256
<context-group purpose="location">
1726117257
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
1726217258
<context context-type="linenumber">56</context>
1726317259
</context-group>
17260+
<context-group purpose="location">
17261+
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
17262+
<context context-type="linenumber">52</context>
17263+
</context-group>
1726417264
<target>LR</target>
1726517265
</trans-unit>
1726617266
<trans-unit id="register.cancelRegistration" datatype="html" resname="register.cancelRegistration">
@@ -17295,46 +17295,46 @@
1729517295
</context-group>
1729617296
<target>LR</target>
1729717297
</trans-unit>
17298-
<trans-unit id="register.step4.3" datatype="html" resname="register.step4.3">
17299-
<source>Step 4 of 5 - Visibility</source>
17298+
<trans-unit id="register.step3.3" datatype="html" resname="register.step3.3">
17299+
<source>Step 3 of 5 - Current employment</source>
1730017300
<context-group purpose="location">
17301-
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
17301+
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
1730217302
<context context-type="linenumber">32,34</context>
1730317303
</context-group>
1730417304
<target>LR</target>
1730517305
</trans-unit>
17306-
<trans-unit id="shared.previousStep" datatype="html" resname="shared.previousStep">
17307-
<source>Previous Step</source>
17306+
<trans-unit id="shared.skipThisStepWithoutAddingAnAffiliation" datatype="html" resname="shared.skipThisStepWithoutAddingAnAffiliation">
17307+
<source>Skip this step without adding an affiliation</source>
1730817308
<context-group purpose="location">
17309-
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
17310-
<context context-type="linenumber">62</context>
17309+
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
17310+
<context context-type="linenumber">68,69</context>
1731117311
</context-group>
17312+
<target>LR</target>
17313+
</trans-unit>
17314+
<trans-unit id="shared.previousStep" datatype="html" resname="shared.previousStep">
17315+
<source>Previous Step</source>
1731217316
<context-group purpose="location">
1731317317
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
1731417318
<context context-type="linenumber">80</context>
1731517319
</context-group>
17320+
<context-group purpose="location">
17321+
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
17322+
<context context-type="linenumber">62</context>
17323+
</context-group>
1731617324
<context-group purpose="location">
1731717325
<context context-type="sourcefile">src/app/register/components/step-d/step-d.component.html</context>
1731817326
<context context-type="linenumber">75</context>
1731917327
</context-group>
1732017328
<target>LR</target>
1732117329
</trans-unit>
17322-
<trans-unit id="register.step3.3" datatype="html" resname="register.step3.3">
17323-
<source>Step 3 of 5 - Current employment</source>
17330+
<trans-unit id="register.step4.3" datatype="html" resname="register.step4.3">
17331+
<source>Step 4 of 5 - Visibility</source>
1732417332
<context-group purpose="location">
17325-
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
17333+
<context context-type="sourcefile">src/app/register/components/step-c/step-c.component.html</context>
1732617334
<context context-type="linenumber">32,34</context>
1732717335
</context-group>
1732817336
<target>LR</target>
1732917337
</trans-unit>
17330-
<trans-unit id="shared.skipThisStepWithoutAddingAnAffiliation" datatype="html" resname="shared.skipThisStepWithoutAddingAnAffiliation">
17331-
<source>Skip this step without adding an affiliation</source>
17332-
<context-group purpose="location">
17333-
<context context-type="sourcefile">src/app/register/components/step-c2/step-c2.component.html</context>
17334-
<context context-type="linenumber">68,69</context>
17335-
</context-group>
17336-
<target>LR</target>
17337-
</trans-unit>
1733817338
<trans-unit id="register.step5.3" datatype="html" resname="register.step5.3">
1733917339
<source>Step 5 of 5 - Terms and conditions</source>
1734017340
<context-group purpose="location">
@@ -21308,6 +21308,14 @@
2130821308
<source>Peer review heading</source>
2130921309
<target>LR</target>
2131021310
</trans-unit>
21311+
<trans-unit id="printView.printSaveAsPdf" datatype="html" resname="printView.printSaveAsPdf">
21312+
<source>Print / Save as PDF</source>
21313+
<target>LR</target>
21314+
</trans-unit>
21315+
<trans-unit id="printView.printThisOrcidProfile" datatype="html" resname="printView.printThisOrcidProfile">
21316+
<source>Print this ORCID profile</source>
21317+
<target>LR</target>
21318+
</trans-unit>
2131121319
</body>
2131221320
</file>
2131321321
</xliff>

0 commit comments

Comments
 (0)