i18n-node-2
i18n-node-2 copied to clipboard
Pull translations from external js/json file
Currently the translations are loaded from files in the locales
directory. Is there a way I can pull in translations from external resource maybe from S3?
I think this should not be related to the i18n-node-2 package itself. Maybe you could add something that downloads from S3 before loading i18n-node-2
While I agree that this is not the responsibility of the i18n-node-2 itself, the package should allow the user to override the load function for the locales files, which will then allow any user who does not wish to use the file system to provide their own implementation.
I believe you can override the use of the locales directory and pass any object to use for each locale at set up...
https://github.com/jeresig/i18n-node-2#locales
The documentation states:
In this particular case no files will ever be read when doing a translation. This is ideal if you are loading your translations from a different source. Note that no defaultLocale is set when you pass in an object, you'll need to set it yourself.
In this circumstance you can provide any javascript object to use—so you should be able to fetch external JSON files and use them here.