@@ -48,29 +48,29 @@ export class TranslateDefaultParser extends TranslateParser
48
48
return expr ;
49
49
}
50
50
51
- return expr . replace ( this . templateMatcher , ( _substring : string , key : string ) =>
51
+ return expr . replace ( this . templateMatcher , ( substring : string , key : string ) =>
52
52
{
53
- return this . getInterpolationReplacement ( params , key ) ;
53
+ const replacement = this . getInterpolationReplacement ( params , key ) ;
54
+ return replacement !== undefined ? replacement : substring ;
54
55
} ) ;
55
56
}
56
57
57
58
/**
58
59
* Returns the replacement for an interpolation parameter
59
60
* @params :
60
61
*/
61
- protected getInterpolationReplacement ( params : InterpolationParameters , key : string ) : string
62
+ protected getInterpolationReplacement ( params : InterpolationParameters , key : string ) : string | undefined
62
63
{
63
- return this . formatValue ( getValue ( params , key ) , key ) ;
64
+ return this . formatValue ( getValue ( params , key ) ) ;
64
65
}
65
66
66
67
/**
67
68
* Converts a value into a useful string representation.
68
69
* @param value The value to format.
69
- * @param fallback the value to return in case value is undefined
70
70
* @returns A string representation of the value.
71
71
*/
72
72
// eslint-disable-next-line @typescript-eslint/no-explicit-any
73
- protected formatValue ( value : any , fallback : string ) : string
73
+ protected formatValue ( value : any ) : string | undefined
74
74
{
75
75
if ( isString ( value ) ) {
76
76
return value ;
@@ -93,6 +93,6 @@ export class TranslateDefaultParser extends TranslateParser
93
93
return JSON . stringify ( value ) ; // Pretty-print JSON if no meaningful toString()
94
94
}
95
95
96
- return fallback ;
96
+ return undefined ;
97
97
}
98
98
}
0 commit comments