transloco
transloco copied to clipboard
Feature(core): nested object in parameters
Is there an existing issue for this?
- [X] I have searched the existing issues
Which Transloco package(s) will this feature affect?
Transloco
Is your feature request related to a problem? Please describe
Nested object in parameters are note handled.
Example: en.json
{
"range": "From {{range.start}} to {{range.end}}"
}
const data = {
range: {
start: 1,
end: 10
}
};
translocoService.translate("range", data);
Returns "From to ".
Describe the solution you'd like
It should return "From 1 to 10".
Describe alternatives you've considered
A workaround is to use flatten:
translocoService.translate("range", flatten(data));
But it is not possible to consider this "solution" when using pipe.
Additional context
No response
I would like to make a pull request for this feature
Yes 🚀
@ben12 Looks good on my end, you are welcome to open a PR for it 👍
Any update on this one? Thxs
@shaharkazaz Wouldn't it make sense to modify lines 52-54 of the default transpilers.ts to call getValue (helpers.ts), thus effectively allowing nested access to params in interpolations.