# Question on internationalisation: Can I have 1 json file for several nodes?

**URL:** <https://discourse.nodered.org/t/question-on-internationalisation-can-i-have-1-json-file-for-several-nodes/76300>\
**Category:** Developing Nodes\
**Tags:** uibuilder\
**Created:** [8 March 2023 14:52 UTC](https://discourse.nodered.org/t/question-on-internationalisation-can-i-have-1-json-file-for-several-nodes/76300 "2023-03-08T14:52:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [8 March 2023 14:52 UTC](https://discourse.nodered.org/t/question-on-internationalisation-can-i-have-1-json-file-for-several-nodes/76300/1 "2023-03-08T14:52:11Z")

</div>

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.

Thanks. J.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 March 2023 15:57 UTC](https://discourse.nodered.org/t/question-on-internationalisation-can-i-have-1-json-file-for-several-nodes/76300/2 "2023-03-08T15:57:06Z")

</div>

It is sort of possible, but not as elegant as perhaps you'd like.

A bit of terminology to help explain, apols if I'm telling you stuff you know, but for future readers of this thread....

In your `package.json` file, you have this:

```auto
  "node-red": {
    "version": ">=3",
    "nodes": {
      "uibuilder": "nodes/uibuilder.js",
      "uib-cache": "nodes/uib-cache.js",
      "uib-element": "nodes/uib-element/customNode.js",
      "uib-update": "nodes/uib-update/customNode.js",
      "uib-sender": "nodes/uib-sender.js",
      "uib-list": "nodes/uib-list/customNode.js"
    },

```

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.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [8 March 2023 15:59 UTC](https://discourse.nodered.org/t/question-on-internationalisation-can-i-have-1-json-file-for-several-nodes/76300/3 "2023-03-08T15:59:12Z")

</div>

Thanks Nick. That helps.

What about the library modules (in `nodes/libs`) - I assume that I'll have to specify the full name there?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 March 2023 16:04 UTC](https://discourse.nodered.org/t/question-on-internationalisation-can-i-have-1-json-file-for-several-nodes/76300/4 "2023-03-08T16:04:06Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [8 March 2023 16:07 UTC](https://discourse.nodered.org/t/question-on-internationalisation-can-i-have-1-json-file-for-several-nodes/76300/5 "2023-03-08T16:07:08Z")

</div>

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 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [22 March 2023 16:07 UTC](https://discourse.nodered.org/t/question-on-internationalisation-can-i-have-1-json-file-for-several-nodes/76300/6 "2023-03-22T16:07:59Z")

</div>

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