handlebars-i18n does install its own version of handlebars, i18next and intl. When having handlebars in a project and using handlebars-i18n there are two versions of handlebars. The helpers that handlebars-i18n registers go into the instance that handlebars-i18n installed and the one actually used in the project does not have the helper.
Example:
import * as handlebars from 'handlebars';
import i18next from 'i18next';
import * as HandlebarsI18n from 'handlebars-i18n';
HandlebarsI18n.init(); // -> Registers helpers in its own instance of handlebars
i18next.init({
resources : {
"en" : {
translation : {
"phrase1": "What is good?",
}
},
},
lng : "en"
});
// -> This is a different instance of i18next than the one used in handlebars-i18n
To fix that I made the dependencies a peerDependency. This also fixes the issue that handlebars-i18n may have outdated versions in its package.json which otherwise needs to be updated constantly.
handlebars-i18n
does install its own version of handlebars, i18next and intl. When havinghandlebars
in a project and usinghandlebars-i18n
there are two versions of handlebars. The helpers thathandlebars-i18n
registers go into the instance thathandlebars-i18n
installed and the one actually used in the project does not have the helper.Example:
To fix that I made the dependencies a peerDependency. This also fixes the issue that
handlebars-i18n
may have outdated versions in its package.json which otherwise needs to be updated constantly.I also updated the readme accordingly.