File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ export * from './preprint-document-type' ;
Original file line number Diff line number Diff line change 1+ import { TranslateService } from '@ngx-translate/core' ;
2+
3+ import { PreprintProviderDetails , PreprintWordGrammar } from '../models' ;
4+
5+ export function getPreprintDocumentType (
6+ provider : PreprintProviderDetails ,
7+ translateService : TranslateService
8+ ) : Record < PreprintWordGrammar , string > {
9+ const key = `preprints.documentType.${ provider . preprintWord } ` ;
10+
11+ return {
12+ plural : translateService . instant ( `${ key } .plural` ) ,
13+ pluralCapitalized : translateService . instant ( `${ key } .pluralCapitalized` ) ,
14+ singular : translateService . instant ( `${ key } .singular` ) ,
15+ singularCapitalized : translateService . instant ( `${ key } .singularCapitalized` ) ,
16+ } ;
17+ }
Original file line number Diff line number Diff line change 11import { StringOrNull } from '@core/helpers' ;
22import { ProviderReviewsWorkflow } from '@osf/features/preprints/enums' ;
3+ import { PreprintWord } from '@osf/features/preprints/models/preprint-provider.models' ;
34import { BrandDataJsonApi } from '@shared/models' ;
45
56export interface PreprintProviderDetailsJsonApi {
@@ -12,7 +13,7 @@ export interface PreprintProviderDetailsJsonApi {
1213 example : string ;
1314 domain : string ;
1415 footer_links : string ;
15- preprint_word : string ;
16+ preprint_word : PreprintWord ;
1617 assets : {
1718 wide_white : string ;
1819 square_color_no_transparent : string ;
Original file line number Diff line number Diff line change @@ -2,6 +2,9 @@ import { StringOrNull } from '@core/helpers';
22import { ProviderReviewsWorkflow } from '@osf/features/preprints/enums/provider-reviews-workflow.enum' ;
33import { Brand } from '@shared/models' ;
44
5+ export type PreprintWord = 'default' | 'work' | 'paper' | 'preprint' | 'thesis' ;
6+ export type PreprintWordGrammar = 'plural' | 'pluralCapitalized' | 'singular' | 'singularCapitalized' ;
7+
58export interface PreprintProviderDetails {
69 id : string ;
710 name : string ;
@@ -10,7 +13,7 @@ export interface PreprintProviderDetails {
1013 examplePreprintId : string ;
1114 domain : string ;
1215 footerLinksHtml : string ;
13- preprintWord : string ;
16+ preprintWord : PreprintWord ;
1417 allowSubmissions : boolean ;
1518 assertionsEnabled : boolean ;
1619 reviewsWorkflow : ProviderReviewsWorkflow | null ;
Original file line number Diff line number Diff line change 19901990 "contributorsLabel" : " Contributors" ,
19911991 "modifiedLabel" : " Modified"
19921992 }
1993+ },
1994+ "documentType" : {
1995+ "default" : {
1996+ "plural" : " documents" ,
1997+ "pluralCapitalized" : " Documents" ,
1998+ "singular" : " document" ,
1999+ "singularCapitalized" : " Document"
2000+ },
2001+ "work" : {
2002+ "plural" : " works" ,
2003+ "pluralCapitalized" : " Works" ,
2004+ "singular" : " work" ,
2005+ "singularCapitalized" : " Work"
2006+ },
2007+ "paper" : {
2008+ "plural" : " papers" ,
2009+ "pluralCapitalized" : " Papers" ,
2010+ "singular" : " paper" ,
2011+ "singularCapitalized" : " Paper"
2012+ },
2013+ "preprint" : {
2014+ "plural" : " preprints" ,
2015+ "pluralCapitalized" : " Preprints" ,
2016+ "singular" : " preprint" ,
2017+ "singularCapitalized" : " Preprint"
2018+ },
2019+ "thesis" : {
2020+ "plural" : " theses" ,
2021+ "pluralCapitalized" : " Theses" ,
2022+ "singular" : " thesis" ,
2023+ "singularCapitalized" : " Thesis"
2024+ }
19932025 }
19942026 },
19952027 "registries" : {
You can’t perform that action at this time.
0 commit comments