Hi, I've a question as I start to prepare uibuilder to use l8n internationalisation rather than fixed text strings.
As in the title - is it possible to define a single locale json file in my Node package that can be used across all of the nodes and their library modules?
The uibuilder node, in particular, uses a sub-folder of library modules, each of which is a class. I do pass the RED object to the library module classes so I can access RED._ but I would like to define common strings across all nodes and modules.
The keys of the nodes property are internally known as the node-set name. Each node-set can have its own message catalog.
There is no concept of a module-wide catalog, but you can look-up messages from any other catalog that node-red has loaded. You do that by prefixing the message identifier with the catalog name.
For example, you could put all your common messages in uibuilder.json and then any other node would be able to use RED._("node-red-contrib-uibuilder/uibuilder:the.message.identifier")
It is a bit long winded to have to fully specify the catalog as well as the message id, but that's how you do it.
It depends where they got their handle to the RED object from. If it was "nodes/uibuilder.js", then I think they will implicitly use the uibuilder catalog (unless they specify a different catalog name).
OK, I'll give that a test. They do get the RED object from the uibuilder node so that should be OK. It is simply passed by reference so that it is available wherever needed.
Thanks again. A day off so making a start on the next release