I18n messages files with multiple custom nodes

I have a single custom module, node-red-contrib-sbi, that contains multiple custom nodes. I've organized node files under subdirectories to keep the project manageable. So my package.json looks like:

  "node-red": {
    "nodes": {
      "start": "flow-control/start.js",
      "data-collector-inline": "io/data-collector-inline.js",
      "basic-data-collector": "io/basic-data-collector.js",
      "data-preview": "data-preview.js",
      "end-node": "flow-control/end-node.js",
    }

I'm have difficulty injecting custom messages though. For example, I've put start.json in both node-red-contrib-sbi/locales/en-US and node-red-contrib-sbi/flow-control/locales/en-US (which is what the docs say to do), but in neither case do they seem to be available. I added a console.log statement to i18n.registerMessageCatalog to see what it's trying to load, and it is only trying to load data-preview.json, which is one of my nodes (notably the only one in the root), but does not even have a translation file.

Where should I be placing the files? Are the multiple sub-directories causing a problem?

The docs illustrate the javascript file being in a subdirectory, so it doesn't seem like it should be a problem.

Output from console debug I added:

namespace=node-red-dashboard/ui_button,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_button.json
namespace=node-red-dashboard/ui_numeric,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_numeric.json
namespace=node-red-dashboard/ui_date_picker,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_date_picker.json
namespace=node-red-dashboard/ui_text_input,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_text_input.json
namespace=node-red-dashboard/ui_slider,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_slider.json
namespace=node-red-dashboard/ui_colour_picker,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_colour_picker.json
namespace=node-red-dashboard/ui_audio,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_audio.json
namespace=node-red-dashboard/ui_toast,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_toast.json
namespace=node-red-dashboard/ui_link,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_link.json
namespace=node-red-dashboard/ui_group,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_group.json
namespace=node-red-dashboard/ui_ui_control,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_ui_control.json
namespace=node-red-dashboard/ui_tab,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_tab.json
namespace=node-red-dashboard/ui_spacer,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_spacer.json
namespace=node-red-node-sentiment/sentiment,dir=D:\nodered-spark-poc\node-red-1.0.3\node_modules\node-red-node-sentiment\locales,file=72-sentiment.json
namespace=node-red-node-rbe/rbe,dir=D:\nodered-spark-poc\node-red-1.0.3\node_modules\node-red-node-rbe\locales,file=rbe.json
namespace=node-red-dashboard/ui_dropdown,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_dropdown.json
namespace=node-red-dashboard/ui_switch,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_switch.json
namespace=node-red-dashboard/ui_form,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_form.json
namespace=node-red-dashboard/ui_gauge,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_gauge.json
namespace=node-red-dashboard/ui_text,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_text.json
namespace=node-red-dashboard/ui_chart,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_chart.json
namespace=node-red-dashboard/ui_template,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_template.json
namespace=node-red-node-tail/tail,dir=D:\nodered-spark-poc\node-red-1.0.3\node_modules\node-red-node-tail\locales,file=28-tail.json
namespace=node-red-contrib-sbi/data-preview,dir=D:\nodered-spark-poc\node-red-1.0.3\node_modules\node-red-contrib-sbi\locales,file=data-preview.json
namespace=node-red-dashboard/ui_base,dir=C:\Users\z003vkcm\.node-red\node_modules\node-red-dashboard\nodes\locales,file=ui_base.json
namespace=editor,dir=D:\nodered-spark-poc\node-red-1.0.3\packages\node_modules\@node-red\editor-client\locales,file=editor.json
namespace=jsonata,dir=D:\nodered-spark-poc\node-red-1.0.3\packages\node_modules\@node-red\editor-client\locales,file=jsonata.json
namespace=infotips,dir=D:\nodered-spark-poc\node-red-1.0.3\packages\node_modules\@node-red\editor-client\locales,file=infotips.json

Also, even if I DO put a node-red-contrib-sbi\locales\en-US\data-preview.json in place, my message still don't resolve when reference via that namespace: RED._("node-red-contrib-sbi/data-preview:start.invoked",{id:req.params.id}) just resolves to start.invoked

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.