Haixing-Hu / vue-i18n

Internationalization plugin of Vue.js
MIT License
62 stars 9 forks source link

There is a two ways binding? #7

Closed bissolli closed 8 years ago

bissolli commented 8 years ago

Hi guys!

I am trying to use this plugin to translate my app and everything were working fine until I had to use the format filter!

It replace the tags properly but when I have any changes on the replace obj it does not apply to the message!

As example I have something similar to the DataTables where I have the message: "Showing {0} entries".. When it first loads works fine! But when I search for something through the filter filterBy the number does not change on the message!

Somebody?

My view: {{ $i18n.messages.data_grid_entries_showing | format listLength }}

where listLength is a computed as bellow listLength () { return this.list.length; }

Haixing-Hu commented 8 years ago

Hi, I checked the issue. Since the argument of the format function should be a value instead of a function, it's better to use a two-way bounded variable instead of a result of a function. More precisely, you should write {{ $i18n.messages.data_grid_entries_showing | format list.length }} where list should be a variable defined in the data of the instance of Vue.

Please check the demo/issue7.html and demo/issue7.js for details.