Hi there! I have a problem. I'm trying to add localization with enyo-ilib to my webos app but I cann't get it done..
My moonstone app structure is like this:
my app/
-- assest
-- dist
....
-- resources/
---- en/strings.json
---- es/strings.json
....
My strings.json files look something like:
{
......
......
"confirm" : {
"title" : "Confirm",
"wakeupcall" : "Do you want to enable wakeup call?",
"specialrequest" : "Do you confirm this service request?",
"yes" : "Yes",
"no" : "No",
"deletewakeup" : "Do you want to remove this wakeup call?"
}
}
I have tried with:
var rb = new ResBundle({locale: "en-US"});
rb.getString('confirm.title');
and:
var $L = require('enyo/i18n').$L;
alert($L('confirm.title'));
But all i get is an alert with: 'confirm.title'.. (that is the key not the value)
So what am I doing wrong ?
0 ·
Comments
enyo/i18n
. The stub method is altered by enyo-ilib when it is loaded. Some other things to check:* The strings.json files are being loaded by looking at the network panel of dev tools
* The current locale is one for which you have a resource bundle using
require('enyo-ilib').getLocale()
* (Lastly) Stepping through
$L
to determine why it might be bailing outFirst, how do I check if the files are being loaded ??, I guess that would be in the chrome inspector on the "source" tab is that ok ?. If that's so, then they are not being loaded because I don't see anything except the assets folder and the index.html..
Then, where does this line
require('enyo-ilib').getLocale()
should be ?And lastly, I have thought about debugging but how do I do that ? I'm using the eclipse based IDE and when I try to debug it just does not do anything.. I can't even set breakpoints..
Thank you!
{ "assets":[ "assets", "resources" ], "vendor": "xxxxx", "largeIcon": "largeIcon.png", "icon": "icon.png", "main": "index.html", "id": "xxxxx", "title": "xxxxx", "type": "web", "version": "0.0.1" }