@@ -85,6 +85,107 @@ function normalizeXlf12Sources(path: string) {
8585 }
8686 } )
8787
88+ // Inject @@printView .* source-only trans-units so the test-language
89+ // generator (generateTestingLanguages) will also stamp X / LR / RL for
90+ // these strings, and so Transifex can discover them for real locales.
91+ // We use a stable @@-prefixed id so $localize can match by explicit id.
92+ const PRINT_VIEW_UNITS = [
93+ 'printView.unnamedProfile' ,
94+ 'printView.orcidIdAlt' ,
95+ 'printView.biography' ,
96+ 'printView.personalInformation' ,
97+ 'printView.emails' ,
98+ 'printView.websitesSocialLinks' ,
99+ 'printView.otherIds' ,
100+ 'printView.keywords' ,
101+ 'printView.countries' ,
102+ 'printView.activities' ,
103+ 'printView.employments' ,
104+ 'printView.educationAndQualifications' ,
105+ 'printView.professionalActivities' ,
106+ 'printView.fundings' ,
107+ 'printView.researchResources' ,
108+ 'printView.works' ,
109+ 'printView.organization' ,
110+ 'printView.organizationAddress' ,
111+ 'printView.startDate' ,
112+ 'printView.endDate' ,
113+ 'printView.publicationDate' ,
114+ 'printView.journal' ,
115+ 'printView.roleTitle' ,
116+ 'printView.department' ,
117+ 'printView.type' ,
118+ 'printView.url' ,
119+ 'printView.untitled' ,
120+ 'printView.identifier' ,
121+ 'printView.enterOrcidId' ,
122+ 'printView.orcidIdHelp' ,
123+ 'printView.loadProfile' ,
124+ 'printView.invalidOrcidId' ,
125+ 'printView.loadingRecord' ,
126+ 'printView.recordNotFound' ,
127+ 'printView.redirectingToPrimary' ,
128+ 'printView.fetchFailed' ,
129+ 'printView.couldNotLoad' ,
130+ 'printView.activityGroupHeading' ,
131+ 'printView.peerReviewHeading' ,
132+ ]
133+ const PRINT_VIEW_SOURCES : Record < string , string > = {
134+ 'printView.unnamedProfile' : 'Unnamed ORCID profile' ,
135+ 'printView.orcidIdAlt' : 'ORCID iD' ,
136+ 'printView.biography' : 'Biography' ,
137+ 'printView.personalInformation' : 'Personal information' ,
138+ 'printView.emails' : 'Emails' ,
139+ 'printView.websitesSocialLinks' : 'Websites & social links' ,
140+ 'printView.otherIds' : 'Other IDs' ,
141+ 'printView.keywords' : 'Keywords' ,
142+ 'printView.countries' : 'Countries' ,
143+ 'printView.activities' : 'Activities' ,
144+ 'printView.employments' : 'Employments' ,
145+ 'printView.educationAndQualifications' : 'Education and qualifications' ,
146+ 'printView.professionalActivities' : 'Professional activities' ,
147+ 'printView.fundings' : 'Fundings' ,
148+ 'printView.researchResources' : 'Research Resources' ,
149+ 'printView.works' : 'Works' ,
150+ 'printView.organization' : 'Organization' ,
151+ 'printView.organizationAddress' : 'Organization address' ,
152+ 'printView.startDate' : 'Start date' ,
153+ 'printView.endDate' : 'End date' ,
154+ 'printView.publicationDate' : 'Publication date' ,
155+ 'printView.journal' : 'Journal' ,
156+ 'printView.roleTitle' : 'Role title' ,
157+ 'printView.department' : 'Department' ,
158+ 'printView.type' : 'Type' ,
159+ 'printView.url' : 'URL' ,
160+ 'printView.untitled' : 'Untitled' ,
161+ 'printView.identifier' : 'Identifier' ,
162+ 'printView.enterOrcidId' : 'Enter an ORCID iD' ,
163+ 'printView.orcidIdHelp' :
164+ 'Add an ORCID iD to the URL or use the form below.' ,
165+ 'printView.loadProfile' : 'Load profile' ,
166+ 'printView.invalidOrcidId' :
167+ 'Enter a valid ORCID iD (format: 0000-0000-0000-0000).' ,
168+ 'printView.loadingRecord' : 'Loading ORCID record...' ,
169+ 'printView.recordNotFound' :
170+ 'Record data was not found in ORCID response.' ,
171+ 'printView.redirectingToPrimary' :
172+ 'Redirecting to primary ORCID record\u2026' ,
173+ 'printView.fetchFailed' : 'Failed to fetch ORCID record' ,
174+ 'printView.couldNotLoad' : 'Could not load' ,
175+ 'printView.activityGroupHeading' : 'Activity group heading' ,
176+ 'printView.peerReviewHeading' : 'Peer review heading' ,
177+ }
178+ const existingIds = new Set ( transUnits . map ( ( tu : any ) => tu ?. $ ?. id ) )
179+ const printViewBody = fileNode ?. body ?. [ 0 ]
180+ PRINT_VIEW_UNITS . forEach ( ( id ) => {
181+ if ( ! existingIds . has ( id ) ) {
182+ printViewBody [ 'trans-unit' ] . push ( {
183+ $ : { id, datatype : 'html' , resname : id } ,
184+ source : [ PRINT_VIEW_SOURCES [ id ] ?? id ] ,
185+ } )
186+ }
187+ } )
188+
88189 writeXlf ( path , data )
89190 generateTestingLanguages ( data )
90191 } )
0 commit comments