I added the code to app.js
:
\\ app.js
const intervalPlural = require('i18next-intervalplural-postprocessor');
const app = new App();
app.middleware('setup').use((handleRequest) => {
handleRequest.app.$cms.I18Next.i18n.use(intervalPlural);
});
The above code is called, but the interval configuratoin doesn’t work.
\\ i18n/en-US.json
"Section": {
"test": "Only one item",
"test_interval": "(0){No items. Nope. None.};",
"test_plural": "{{count}} items"
}
And also:
\\ handler.js
const text = this.t('Section.test',
{ postProcess: 'interval', count: myArray.length });
I also tried setting the postProcess
value in config:
\\ config.js
i18n: {
returnNull: false,
fallbackLng: 'en-US',
postProcess: ['interval'],
},
The processing when the count is 0 still uses _plural
instead of _interval
I tried the middleware setup call at various places in app.js
and it still doesn’t work.
Thoughts?