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
Hi there, what are your thoughts on exposing the default core methods for use in overriding hooks in manageTranslations? I'd like to be able to augment the default functionality with some of my own pre- or post- behavior, or in some cases overriding it entirely. For example, I'd like to be able to:
import manageTranslations, {
provideWhitelistFile
} from 'react-intl-translations-manager';
manageTranslations({
messagesDirectory: 'src/messages/
translationsDirectory: 'src/translations/',
languages: ['fr-ca'],
overrideCoreMethods: {
provideWhitelistFile: (lang, options) => {
// Decide whether to do something here
if (foo === bar) {
return baz;
} else {
// Otherwise do the default thing
return provideWhitelistFile(lang, options);
}
}
}
});
The API for them would need to change slightly to accept the options that were passed into manageTranslations instead of being closures around the options within manageTranslations itself.
I haven't attempted this yet, but am interested in your appetite for considering such a change. The nice part is that the changes should be backwards compatible: any existing overridden hooks in the wild would already be standalone and ignore the new additional options argument. It would also make these core methods more testable, which could fill the gap in testing around manageTranslations itself.
The text was updated successfully, but these errors were encountered:
This would be indeed nice to have, now the ability to override the hooks is not very useful if the need is to observe the resulting report or augment the output or functionality somehow, the current hook system only supports replacing the default functionality fully.
Hi there, what are your thoughts on exposing the default core methods for use in overriding hooks in
manageTranslations
? I'd like to be able to augment the default functionality with some of my own pre- or post- behavior, or in some cases overriding it entirely. For example, I'd like to be able to:The API for them would need to change slightly to accept the options that were passed into
manageTranslations
instead of being closures around the options withinmanageTranslations
itself.I haven't attempted this yet, but am interested in your appetite for considering such a change. The nice part is that the changes should be backwards compatible: any existing overridden hooks in the wild would already be standalone and ignore the new additional
options
argument. It would also make these core methods more testable, which could fill the gap in testing aroundmanageTranslations
itself.The text was updated successfully, but these errors were encountered: