jeresig / i18n-node-2

Lightweight simple translation module for node.js / express.js with dynamic json storage. Uses common __('...') syntax in app and templates.
MIT License
507 stars 79 forks source link

How access translations in a structured json? #37

Closed marcbruederlin closed 10 years ago

marcbruederlin commented 10 years ago

How can I access translations in a structured json?

My json:

{
    "first-level": "shown",
    "test": {
        "lorem": "ipsum",
        "foo": "bar"
    }
}
req.i18n.__('first-level') // prints "shown"
req.i18n.__('test.lorem') // prints "test.lorem"
netpoetica commented 10 years ago

Can you do

req.i18n.__('test').lorem

?

marcbruederlin commented 10 years ago

Yes, thank you! :)