Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull translations from external js/json file #91

Open
chrisj12 opened this issue Mar 17, 2016 · 3 comments
Open

Pull translations from external js/json file #91

chrisj12 opened this issue Mar 17, 2016 · 3 comments

Comments

@chrisj12
Copy link

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?

@gjuchault
Copy link
Collaborator

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

@wallali
Copy link

wallali commented Jun 9, 2017

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.

@grantschulte
Copy link

grantschulte commented Feb 12, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants