-
-
Notifications
You must be signed in to change notification settings - Fork 578
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
Translate directive fails to update values on language change, when values are surrounded by newlines #1163
Comments
Thanks, I'll take a look at it when I can, but if you want to try to do a PR that would be even better. |
Co-authored-by: David Störmer <[email protected]> Fixes #998 #1153 #1163
I have a new test and a one-line code change that I believe addresses this issue, and was going to post the PR today. I'll pull down the latest master branch and re-evaluate. At a minimum, I believe that I introduced a bug with this line:
When Angular re-interpolates the value from a variable into the DOM, I'm pretty sure that new value needs to be captured as the new translation key, otherwise it won't get re-translated. So, keeping the old content in a lookup key variable is incorrect. (edited) |
Current behavior
Template elements which use the
translate
directive and whose value are surrounded by newlines do not respond to language changes. If that value is interpolated from an angular variable,it's not initially translated at allthe initial value is translated, but changes to the variable cause the original key text to be displayed, and at no point does it appear to respond to language changes.See also: #998 (comment)
Possibly related: #1091
Expected behavior
translate
directive properly translates the specified value.How do you think that we should fix this?
Unknown. The issue appears to pre-date release 12.0.0, although
#998 / #1016 appears to have made things a bit worse in that interpolated variables
are not translated at all nowdon't respond to language changes now.Minimal reproduction of the problem with instructions
Specify a translated div or span in the angular template file, which includes newlines around the value to be translated:
In the component implementation file:
In the en.json file:
Environment
The text was updated successfully, but these errors were encountered: