Can't determine if i18next has been initialized post initialization.
See original GitHub issueI am currently trying to determine if i18next has been initialized asynchronously prior to requesting translations.
For example:
i18next.init();
setTimeout(function () {
i18next.on('initialized', function () {
console.log('may not run?');
}
}, 500);
This is had originally been implemented in #380, but was removed during the 2.0.0 rewrite.
Is there a way to detect if i18next is already initialized?
Personally I would prefer if the callback in i18next.on('initialized', callback) was run immediately if i18next has already been initialized.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
i18next - initialization
If language is not set explicitly i18next tries to detect the user language by: ... Set language after init: i18n.setLng('en-US', function(err, ...
Read more >Configuration Options - i18next documentation
Set it to false if your backend loads resources synchronously - that way, calling i18next.t() after init() is possible without relying on the...
Read more >How to use the i18next.isInitialized function in i18next - Snyk
isInitialized) i18n.init(options) // a simple helper to getInitialProps passed on loaded i18n data i18n.getInitialProps = (req, namespaces) => { if ...
Read more >You will need to pass in an i18next instance by using ...
init () inside beforeEach hook? And i18n should be the instance of your instantiated i18n instance. The only difference that in my case...
Read more >Beginning JavaScript I18n with i18next and Moment.js | Phrase
We'll want a default locale to use when we can't find ... i18next has its own init function that accepts an options object...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I ended up doing something like this:
the options can be found on i18next.options