You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I didn't want to have to specify {postProcess: 'interval'} every time I wanted to use the interval post-processing, so I passed it to the i18next.init options instead and this caused translations without any options to fail at this line:
constindex=newOptions.postProcess.indexOf('interval');// <-- Not supported in <IE9
To Reproduce
i18next.init({postProcess: 'interval',
...
})// ...i18next.t("some-key")// Fails because it has no postProcess option
Expected behavior
The examples show postProcess: 'interval' being passed to every translation that wants to use it, so it seems to be intended behavior that this would fail, but it really shouldn't. Having to pass that option for every interval is annoying and makes the code more complicated. It already has the _interval suffix in the key, so why do we need this option? Else, why bother with the suffix? Seems like if the key has the _interval suffix it should just post process with this plugin, or this plugin should try to post process everything and check if the entry has interval post processing and handle it if so.
Just something so postProcess: 'interval' doesn't have to be passed every time, or allow postProcess: 'interval' to be specified in i18next.init and not fail on keys without options or _interval suffixes.
i18next.init({postProcess: 'interval',// ...})// ...i18next.t("some-key")// Works!// ...i18next.t("other-key_interval",{count: 3})// Works and handles intervals!
Your Environment
Don't think it really matters, seems like it's just a flaw in the coding but...
runtime version: electron 13, node 14
i18next version: 20.3.4
os: Windows
The text was updated successfully, but these errors were encountered:
I mean even once, you set up i18next and tell it to use this plugin, why would I then have to pass this extra argument to get the functionality? There may be a good reason why it was done, I just don't see it personally. Just seems like one more thing to forget to do down the line when I haven't been focused on internationalization for a while and want to use an interval, you know?
I'll see about taking a stab at a PR when I have some time.
🐛 Bug Report
I didn't want to have to specify
{postProcess: 'interval'}
every time I wanted to use the interval post-processing, so I passed it to thei18next.init
options instead and this caused translations without any options to fail at this line:i18next-intervalPlural-postProcessor/src/index.js
Line 52 in 68c6f90
To Reproduce
Expected behavior
The examples show
postProcess: 'interval'
being passed to every translation that wants to use it, so it seems to be intended behavior that this would fail, but it really shouldn't. Having to pass that option for every interval is annoying and makes the code more complicated. It already has the_interval
suffix in the key, so why do we need this option? Else, why bother with the suffix? Seems like if the key has the_interval
suffix it should just post process with this plugin, or this plugin should try to post process everything and check if the entry has interval post processing and handle it if so.Just something so
postProcess: 'interval'
doesn't have to be passed every time, or allowpostProcess: 'interval'
to be specified ini18next.init
and not fail on keys without options or_interval
suffixes.Your Environment
Don't think it really matters, seems like it's just a flaw in the coding but...
The text was updated successfully, but these errors were encountered: