@@ -71,7 +71,7 @@ export function run(path) {
71
71
to : match => match . replace ( / T r a n s l a t e S e r v i c e | T r a n s l a t e P i p e / g, 'TranslocoService' )
72
72
} ;
73
73
74
- const instantTranslation = {
74
+ const serviceTranslation = {
75
75
...tsFiles ,
76
76
from : / [ ^ ] * (? = (?: p r i v a t e | p r o t e c t e d | p u b l i c ) \s + ( [ ^ , : ( ) ] + ) \s * : \s * (?: T r a n s l o c o S e r v i c e \s * (?: , | \) ) ) ) [ ^ ] * / gm,
77
77
to : match => {
@@ -82,9 +82,12 @@ export function run(path) {
82
82
. split ( '' )
83
83
. map ( char => ( [ '$' , '^' ] . includes ( char ) ? `\\${ char } ` : char ) )
84
84
. join ( '' ) ;
85
- return match . replace ( new RegExp ( `(?:(?:=\\s*|this\\.)${ sanitizedName } )\\.(instant|transform)` , 'g' ) , str =>
86
- str . replace ( / i n s t a n t | t r a n s f o r m / , 'translate' )
85
+ const functionsMap = { instant : 'translate' , transform : 'translate' , get : 'selectTranslate' } ;
86
+ const translationCalls = new RegExp (
87
+ `(?:(?:\\s*|this\\.)${ sanitizedName } )(?:\\s*\\t*\\r*\\n*)*\\.(?:\\s*\\t*\\r*\\n*)*(instant|transform|get)` ,
88
+ 'g'
87
89
) ;
90
+ return match . replace ( translationCalls , str => str . replace ( / i n s t a n t | t r a n s f o r m | g e t / , func => functionsMap [ func ] ) ) ;
88
91
}
89
92
} ;
90
93
@@ -112,8 +115,8 @@ export function run(path) {
112
115
step : 'constructor injections'
113
116
} ,
114
117
{
115
- matchers : [ instantTranslation ] ,
116
- step : 'instant translations'
118
+ matchers : [ serviceTranslation ] ,
119
+ step : 'service translations'
117
120
}
118
121
] ;
119
122
0 commit comments