Cannot use jsreport.localization.localize in helper

  • Hi, I'm trying to use jsreport.localization.localize as shown in the example in the "Complex use case" of the localization documentation ( and it works fine when I use the studio, but when I render the report from Javascript code I get this error:

    TypeError: Cannot read properties of undefined (reading 'localize')

    One reason may be that I'm using jsreport-core to render from Javascript. I don't know if it has something to do with the error.

    const jsreport = require('@jsreport/jsreport-core')(options);
    jsreport.use(require('@jsreport/jsreport-pdf-utils')({ syncModifications: false }));
          template: {
            name: reportName
          options: {
            localization: { language: 'en' },

    One thing I've noticed is that when printing the jsreport-proxy properties in the helper, it does not have the 'localization' property when rendering form JS, whereas that property exists when rendering from the studio.

    const jsreport = require('jsreport-proxy');

    Is there anything else I need to import in order to use the localize function in the helper?

    Thank you.

  • administrators

    @blizarazu i don't see the @jsreport/jsreport-localization extension used in your code, seems like you are missing that dependency

  • Thank you very much @bjrmatos! That was the problem.

Log in to reply

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.