aurelia / i18n

A plugin that provides i18n support.
MIT License
93 stars 70 forks source link

i18n via t.bind fails to clear translated string when key becomes undefined #313

Open peitschie opened 4 years ago

peitschie commented 4 years ago

I'm submitting a bug report

Current behavior: When using the t.bind syntax, translations will not be correctly cleared when bound value becomes undefined. Reproduction at: https://github.com/peitschie/bug-repro-aurelia-i18n-bind.

On initial load, model A is populated, which contains a valid i18n key for both line 1 and 2: image

Clicking the Load model B button then causes the bound values to be replaced with a new model that only has the line 1 property defined: image

Note that when using the t.bind syntax, the Model A line 2 translation cell is left bound.

This behaviour differs when the key is fed via the t value converter (see the last column in the table), which does correctly clear the translation of line 2 when the second model is loaded.

Expected/desired behavior: I am expecting the behaviour of t.bind to match the behaviour seen for ${ key & t}. It seems logical to me that if the bound value is set to undefined or cleared, the translation should also be cleared to reflect the new model.

zewa666 commented 4 years ago

The reason why it happens is simple, the problem is I can't recall why that was added ;) I'll need to dig up a bit

zewa666 commented 4 years ago

PR is the works lets see this shouldn't hopefully take long to fix @peitschie. Love your nickname btw ;)