EddyVerbruggen / nativescript-localize

Internationalization plugin for NativeScript using native capabilities of each platform
MIT License
79 stars 31 forks source link

localize text blank #71

Closed mandrag0ra closed 5 years ago

mandrag0ra commented 5 years ago

Hi,

I have got two or three pages where I don't need a page-view-model.js and don't use any binding content (no observables). I just have a page-page.js with a "next" button

// some-page.js
exports.onTap = args => {
        const button = args.object;
        const page = button.page;
        page.frame.navigate({ moduleName: "another-page" });
    };

In this case, the localized texts are blank. Could you please tell me if this is a normal behavior ? Thanks. Wil.

mandrag0ra commented 5 years ago

In case someone else is searching for this, adding an empty observable did the trick.

const fromObject = require("tns-core-modules/data/observable").fromObject;

function onPageLoaded(args) {
    const page = args.object;
    const source = fromObject({});
    page.bindingContext = source;
}