question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Parse variable inside nested translations

See original GitHub issue

I’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:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
shaharkazazcommented, Apr 17, 2020

@foucdeg available in v2.15.0, Also updated the docs

0reactions
foucdegcommented, Apr 19, 2020

Awesome! Thanks.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found