Closed daresh closed 6 years ago
Weird, but it started working after I added some empty observable and bound it:
const observableModule = require("data/observable"); const context = new observableModule.fromObject({}); exports.onLoaded = function (args) { page = args.object; page.bindingContext = context; };
Don't know if it's a bug or a feature, you may take a look at it :)
Not a bug nor a feature, it seems that you have to add a bindingContext to access application resources, if you take a look at the demo, I just do page.bindingContext = {};
Thanks! So it's just a thing to remember :)
Is it possible to localize also code in JS, like for example alert messages using your plugin?
Yes you can, just use the localize function directly:
const localize = require("nativescript-localize").localize;
Hi!
I have an issue with the localize plugin. I have a simple app with two pages.
XML of page 1: `
`
XML of page 2: `
`
After running the app (even after tns platform clean android and then run) I have empty controls on the first page, here's what I see in the chrome debug: `
`
The other page works fine, all the texts are in place and translated.
The lang file en.default.js:
module.exports = { "app.name": "Rorschach Test", "welcome" : "Welcome!!", "start.test" : "Start the test", "q1.ans1" : "answer1" }
NativeScript Core, Windows 10, target platform android, everything is a fresh install (latest versions).