Closed aviavia closed 7 years ago
I'm regrettably forced to mark this as help-wanted as I have no personal experience with Cordova. Not sure what the debugging process is for cordova apps but are there no errors anywhere at all?
Not sure how to debbug the apk yet. On the browser there are not related errors.
The cordove errors i get: console.log('deviceready has not fired after 5 seconds.'); and : Channel not fired: onDOMContentLoaded
And seems like this is a warning regarding the time it take the app to load.
This is the generated script tag:
< script id='msgfmt' type='application/ejson'>{"native":"en","locales":{"he":1471183905678,"all":1471183905678},"sendPolicy":"all"}< / script>
Can I just confirm that your msgfmt
key in settings.json
is under public
?
Out of curiosity, do you get the same error without msgfmt installed? We do some things when the page is fully loaded, if something (outside of msgmft) is preventing that, msgfmt initialization won't complete.
Also, is there any more info you can get with:
msgfmt.init('en', {
...,
logLevel: 'debug' // or 'trace'
})
Do you have access to the browser console? (If I'm not mistaken you can access it remotely via desktop Chrome). Does msgfmt.strings.he
have the translations?
Yes, i am accessing the browser console with the device connected. the settings.json is not in public, but the other settings are at public/lib msgfmt.init('en', { sendPolicy: 'all', locales: ["he"] }); i can't remove the package for testing this warning...(there are 100's of lines with mf...) So maybe I need to re init msgfmt? how do i do that?
Sorry, I wasn't clear; I meant the msgfmt
key inside settings.json
should be under the public
key, i.e.
{
"public": {
...,
"msgfmt": {
"native": "en",
"locales": ["en", "he"]
}
}
}
so it should be available in the browser as Meteor.settings.public.msgfmt
. Can you confirm?
msgfmt.resetStorage()
will delete the local cache in localStorage and reload everything it needs from scratch. Does it make any difference?
yes it's added to the settings.public. I will try that and let you know. msgfmt.resetStorage(). where/when would you suggest to use it?
Yes, this returns the object : Meteor.settings.public.msgfmt, both from browser and apk.
Yes, msgfmt.strings.he returns the translation json. If I run msgfmt.resetStorage() on the console it returns undefined.
Same here, android apk fails to start with msgfmt. I use --settings for iOS and it works, but fails on android. Cordova apps does't have server, is it possible somehow to make lite version without all staff, only getting translation strings from server database via subscription?
@MartinFournier I'm wondering if you ever came across anything like this?
@tdesc, which stuff? I was hoping to include strings as part of the Meteor build process, but with limited time and a lot of changes in Meteor's direction over the last year, this is off the cards for the next long while :( It sounds like all the strings are loading fine though (obviously not for an offline app), and translations not working maybe because the client side (in general) is failing to init. But yes I would like to improve on this going forward.
Solved by fixing any "browser policy" errors. None of the errors was pointing to that script, but fixing all the other errors solved the issue. Thanks :)
On the config.js at lib i have: msgfmt.init('en', { sendPolicy: 'all', locales: ["he"] });
and on settings.json i have: "msgfmt": { "native": "en", "locales": ["he"] }
On the browser I see the translation works, but on the apk it doesn't. Before adding the above lines to the settings.json file, in some devices I was able to see translation in some devices, but after adding, it doesn't appear in any of the devices I check with. Thanks.