Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically interpolated variable is not translated when variable changes #1176

Open
dpmott opened this issue Feb 21, 2020 · 2 comments
Open

Comments

@dpmott
Copy link
Contributor

dpmott commented Feb 21, 2020

Current behavior

When a variable (such as a Component attribute used in a template, holding a translation key) is used with the translate directive on an element with content which includes an interpolated variable, it is initially translated correctly, but when the value is later changed, the displayed text is untranslated.

As an example, the template would use the translate directive like this:
<div translate>{{ weekday }}</div>

Expected behavior

The key value in the variable should be translated and displayed whenever the variable is updated.

How do you think that we should fix this?

#1169

Minimal reproduction of the problem with instructions

https://stackblitz.com/edit/github-7csm2q

Click the "Click Me" button.
Select a different language.
Notice that the middle line misbehaves.

Environment


ngx-translate version: 12.1.1
Angular version: 8.2.14

Browser:
- [X] Chrome (desktop) version XX
- [ ] 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
 
For Tooling issues:
- Node version: v10.18.1
- Platform:  Windows

Others:
@xsegrity
Copy link

I am having the same problem with v12.1.1 after upgrading to angular v9. As a workaround I was able to change the directive <div translate>{{ myvar }}</div> to use a pipe <div>{{ myvar | translate }}</div>.

@anth-git
Copy link

anth-git commented Sep 1, 2020

I have the same problem. It's not working since version 12, so I'm stuck with 11.
Any plans for fixing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants