tolgee-js icon indicating copy to clipboard operation
tolgee-js copied to clipboard

Angular `t` component does not re-evaluate translation when inputs change.

Open IBlackI opened this issue 2 years ago • 0 comments

When any of the inputs of the t component change the translation is not updated. This is especially annoying when you are using parameters in the translation, because it will display incorrect.

This subscription is only created onInit and not updated when there are changes. https://github.com/tolgee/tolgee-js/blob/dcbded7f7d158facb5eac126baf2ec1e1dc5699e/packages/ngx/projects/ngx-tolgee/src/lib/t.component.ts#L33

Versions used: "@tolgee/ngx": "^4.9.2", "@tolgee/ui": "^4.9.2", "@angular/core": "12.2.16", <-- shouldn't isn't the cause of this issue, update behaviour hasn't changed in Angular 13

Proposed solution: Implement the OnChanges lifecycle hook. https://angular.io/api/core/OnChanges

IBlackI avatar Sep 21 '22 13:09 IBlackI