Closed raksa closed 1 year ago
Is any update about this issue? @mashpie
Is any update about this issue? @mashpie
Check here it’s working https://github.com/raksa/i18n-node
.json is the only supported storage by now. Native, no deps, no eval, no vulnerabilties. Plus: anyone van transpile almost anything to json.
No eta but a new 1.x branch will add pluggable Storage interface. Let there be yaml, toml, csv, tsv, ini, js or Redis, mongo, Couch, sql.
Internally all those will be processed as js objects to any extend... and by now json represents the serialized Version of that object in a native cheapest human read/writable way possible.
Thank you for you answers. Just so you, I moved to i18n-next and it works fine.
Alright, I like i18n-next as a framework with it's plugins and adapters while i18n-node
intended to be a lib not a framework. Do you also plan to try integration with https://locize.com/ (just curious)?
I'm using i18n-next as i18n-node. I'm exporting my js translations and it works well. I was happy to use your package but it's very useful to use .js extension if you're coding in TS.
PS: I don't plan to use locize.com service ;)
...ts I see - well, what I am thinking of is to add a setCatalog()
as the logikal counterpart to getCatalog()
https://github.com/mashpie/i18n-node#i18ngetcatalog
That would open up loading translations programmatically from any external source anyway and give devs complete control. Like in this case just require()
these .js modules and set them, like:
// en.js
module.exports = {
'Ola': 'Hi'
}
// any app.js
const transEN = require('./en.js')
i18n.setCatalog(transEN, 'en')
or maybe
// myTranslations.js
module.exports = {
'en': {
'Ola': 'Hi'
},
'de': {
'Ola': 'Hallo'
}
}
// any app.js
const translations = require('./myTranslations.js')
i18n.setCatalog(translations)
plus options for adding, merging and similar edge cases (fallbacks, contexts, etc.)
Ok, let's keep this open as note of WIP
Any news on this feature @mashpie ?
actually this should be resolved by https://github.com/mashpie/i18n-node#some-words-on-staticcatalog-option
in locale i need en.js
with:
should work as normal