TwigExtension added to Craft don’t work in emails I added tomodomo/twig-pluralize-extension to my project composer, loaded with a custom module like that :

if (Craft::$app-&gt;request-&gt;getIsSiteRequest()) {
    // Add in our Twig extension
    $pluralize = new \Tomodomo\Twig\Pluralize;
    Craft::$app-&gt;view-&gt;registerTwigExtension($pluralize);
}


I use this to pluralize some string in my templates and email templates. When I check the url to my email template, everything work fine but the email didn’t send out because of "unknown function pluralize".

I have another custom module (to handle something else in my emails) and this part work fine. 

Do I need to register/declare TwigExtensions with another method to get them work in emails ?

Note: 


The only error related to my emails in the logs is about pluralize
function missing.
Everything work fine if I don’t use |pluralize
All you should need to do is remove this condition check:

if (Craft::$app-&gt;request-&gt;getIsSiteRequest()) {


You are only registering the twig extension for front end (site) requests, but emails can be triggered both on a cart complete front end (site) requests AND a back-end (CP) order status changes.