Why doesn't my i18n work?

#1

My custom package has this directory structure:

  • [root]
    • package.json
    • ninox
      • ninox.html
      • ninox.js
      • locales
        • en-US
          • ninox.json

In package.json, this:

  ...
  "node-red": {
    "nodes": {
      "ninox": "ninox/ninox.js"
    }
  }
  ...

In locales/en-US/ninox.json, this:

{
    "ninox": {
        "method.label": "Method",
        ...
    }
}

In ninox.js, this:


...
        console.log("i18n", RED._("ninox:method.label"));

Actual output: i18n method.label
Expected output: i18n Method

What am I doing wroing

0 Likes

#2

The problem is probably related to an invalid path in your call to RED._() .... maybe something like RED._("node-red-contrib-ninox/ninox:method.label") should work (that is if your node-module is named node-red-contrib-ninox).

0 Likes