question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add use array for plugins

See original GitHub issue

Currently, users cannot implement plugins because next-i18next calls .init on the i18n instance, and plugins via .use must be called before .init.

We should add a use array to the next-i18next config, so that we can simply do:

config.use.forEach(x => i18n.use(x))
i18n.init() // Somewhere later on

Note that server/client detection will remain a responsibility of the user. Implementation might look like:

const NextI18Next = require('next-i18next').default

const use = []
if (process.browser) {
  use.push(someBrowserPlugin)
}

module.exports = new NextI18Next({ use })

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
isaachinmancommented, Dec 4, 2018

Two liner solution: 14d494f.

We may in the future want to talk about removing the .use calls in create-i18next-client, but in my opinion they are a core part of the value added by using this package in the first place.

@lucasfeliciano, @mshahov, and @kachkaev - I would appreciate your help testing this solution out. I’m going to release v0.8.0 now.

3reactions
isaachinmancommented, Dec 4, 2018

@lucasfeliciano I’m already working on it, no need for a PR. I’ll handle core features like this myself for the time being.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add use array for plugins · Issue #28 · i18next/next ... - GitHub
Currently, users cannot implement plugins because next-i18next calls .init on the i18n instance, and plugins via .use must be called before .init.
Read more >
merging an array to an existing array using add_filter
I have tried this method here Insert new element to array with add_filter but the output is just this Array ( [Hello5] =>...
Read more >
Webpack using plugins array - Stack Overflow
Can we use array of plugins ? Yes, but your code is currently producing an array of plugins with another array of plugins...
Read more >
How To Use Motion Array's Stretch Plugin for Premiere Pro
Check out our best Premiere downloads: https:// motionarray.com/browse?date_a... And check out our full article on this effect: ...
Read more >
How to Install Motion Array Plugins for Premiere Pro
Learn how to install Premiere Pro plugins from Motion Array. The process really simple, so follow along to get up and running in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found