Using Sails.js
version 0.10.x
and trying to get the i18n stuff to work.
I have the following in my config/locales/en.json
{
"countries": {
"au": {
"name": "Australia",
"fiatCurrency": "AUD",
"subnationalDivisions": {
"NSW": "New South Wales",
"WA": "Western Australia",
"VIC": "Victoria",
"QLD": "Queensland",
"TAS": "Tasmania",
"SA": "South Australia",
"NT": "Northern Territory",
"ACT": "Australian Capital Territory"
}
}
}
}
My config/i18n.js
file looks like
module.exports.i18n = {
// Which locales are supported?
locales: ['en', 'es', 'fr', 'de'],
objectNotation: true
};
In my controller I am trying to retrieve the correct subnationalDivision
name via
res.i18n("countries." + country + ".subnationalDivisions." + state)
but that just gives me "countries.au.subnationalDivisions.ACT"
, not "Australian Capital Territory"
I've check with a trivial example:
Given en.json
file containing { "bingo" : "sparky" }
, res.i18n("bingo")
outputs "sparky"
But examples using objectNotation
don't work despite the instructions in the i18n-node documentation.
How should I get this to work?