Parse variable inside nested translations
See original GitHub issueI’m submitting a…
[ ] Regression (a behavior that used to work and stopped working in a new release)
[ ] Bug report
[ ] Performance issue
[x] Feature request
[ ] Documentation issue or request
[ ] Support request
[ ] Other... Please describe:
Current behavior
This is my translations file, where I use another translation key in a translation value as documented:
{
"greetPerson": "Hi {{name}}",
"welcome": "{{ greetPerson }}, welcome to my site!"
}
Template code :
<p>{{ 'welcome' | transloco: { name: 'Bob' } }}</p>
This outputs “Hi {{ name }}, welcome to my site!”
Expected behavior
“Hi Bob, welcome to my site!”
Minimal reproduction of the problem with instructions
Use the code above (I tried the stackblitz but couldn’t make recompilation work)
Environment
Angular version: 9.0.7
Browser:
- [x] Chrome (desktop) version 80
Below were not tested:
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How do I use variables inside a stringified key in a nested dict?
I'm calling an api to fetch the values which I need to pass using variables inside text . For example the text contains...
Read more >Nesting - i18next documentation
Nesting allows you to reference other keys in a translation. ... Make sure the options string is valid JSON and can be parsed...
Read more >i18next - features
The translation will be joined with '\n'. Hint: This might be useful in combination with post processing. arrays in json.
Read more >Troubleshoot Variables in parfor-Loops - MATLAB & Simulink
Solve Variable Classification Issues in parfor -Loops · If you use a nested for -loop to index into a sliced array, you cannot...
Read more >Destructuring assignment - JavaScript - MDN Web Docs
Two variables values can be swapped in one destructuring expression. ... which can be parsed in a single line with destructuring.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@foucdeg available in v2.15.0, Also updated the docs
Awesome! Thanks.