using namespaces
Closed this issue · 2 comments
Hi,
i setup the plugin like this:
plugin('aurelia-i18n', (instance) => {
// adapt options to your needs (see http://i18next.com/pages/doc_init.html)
instance.setup({
resGetPath : 'locale/__lng__/__ns__.json',
lng : 'en',
attributes : ['t','i18n'],
sendMissing : false,
fallbackLng : 'en',
debug : false,
getAsync: false,
ns: {
namespaces: ['common', 'translation'],
defaultNs: 'translation'
}
});
})
I have placed both translation.json and common.json under "locale\en" and when the site is loading i see that both files where loaded.
Unfortunately none of the translation from common.json are working and i get not found exceptions, it seems that i18 doesnt work with that file at all.
If i change defaultNs from 'translation' to 'common' the translations from common.json start working but translation.json stop working.
I am using aurelia-i18n version 0.4.6.
Can you please help me with this issue.
Thanks,
Alex
O.K, i understood what the problem was.
In order to use translation from a namespace that isn't default the code should be something like that:
<div t="common:some string"></div>
In order to use translation from the default namespace it can be done like this:
<div t="some string"></div>