nativescript-localize icon indicating copy to clipboard operation
nativescript-localize copied to clipboard

The instruction for Vue is out-of-dated

Open shilik opened this issue 6 years ago • 2 comments

Hi, ifabreges Thanks for the great plugin. It took me a while figuring out how to make it work on my nativescript-vue project. As nativescript-vue has been updated to 2.0. The following settings work for me.

in main.js file const application = require("application"); const localize = require("nativescript-localize"); application.setResources({ L: localize }); Vue.filter("L", localize);

in abc.vue file <Label :text="'test'|L"/> works like charms while <Label :text="'I am %s'|L('user name')"></Label> will yield errors.

shilik avatar Dec 09 '18 09:12 shilik

I tested it and adding the L pipe to the application resources isn't required. It seems that nativescript is not taking into account the modified strings file at build time, it only takes it into account during the next build. I don't know how to fix that for now.

lfabreges avatar Jan 05 '19 13:01 lfabreges

With Vue.filter, it just doesn't work for me...

Whatever I try it always crash with a message saying _vm.L is not a function.

The only way I found to make it work is to not use Vue.filterand directly declare the function for every Vue instance using Vue.prototype.L = localize

elie-g avatar May 20 '19 00:05 elie-g