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

Untranslated keys always return the original value - Breaking change between v11.0.1 & v12.0.0 #1164

Closed
Hannao94 opened this issue Feb 11, 2020 · 0 comments

Comments

@Hannao94
Copy link
Contributor

Hannao94 commented Feb 11, 2020

Current behavior

In version 12.0.0, the translate directive use the node.originalValue when the key passed is not present in the translation file.
node.originalValue is the first computed value for the text by angular change detection. This test/value can be changed to a completely different value.

Expected behavior

The same behavior as in v11.0.1, the directive should use the current text/value computed by angular change detection

How do you think that we should fix this?

in translate.directive.ts line 88-89
change

// the content was changed from the user, we'll use it as a reference if needed
node.originalContent = node.originalContent || content;

to (it actually makes more sense according to the comment I think)

// the content was changed from the user, we'll use it as a reference if needed
node.originalContent = content || node.originalContent;

Minimal reproduction of the problem with instructions

Have translate directive on a span with a variable. The variable uses some values which are not present in the json translation file. Dynamically change the variable value.

Environment

ngx-translate version: 12.0.0
Angular version: 8.2.14

Browser:

  • Chrome (desktop) version 73

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

Successfully merging a pull request may close this issue.

1 participant