I'm trying to understand existing code of the Switch node in node-red to deal with and make my own node correctly.
I'm stuck with these lines :
var operators = [
{v:"eq",t:"=="},
{v:"neq",t:"!="},
{v:"lt",t:"<"},
{v:"lte",t:"<="},
{v:"gt",t:">"},
{v:"gte",t:">="},
{v:"btwn",t:this._("switch.rules.btwn")},
{v:"cont",t:this._("switch.rules.cont")},
{v:"regex",t:this._("switch.rules.regex")},
{v:"true",t:this._("switch.rules.true")},
{v:"false",t:this._("switch.rules.false")},
{v:"null",t:this._("switch.rules.null")},
{v:"nnull",t:this._("switch.rules.nnull")},
{v:"else",t:this._("switch.rules.else")}
];
Especially with the this._("switch.rules.smthg")
. How it will work ? Sometime in the code, i will see this call, but i'm not able to find where is it stored, and so make my own, like this._(myawesomenode.myawesomesection.myawesomepropertie)
Thanks to your comments, i've seen it's for internationalisation.
Suppposing i have this catalog :
{
"and": {
"list": {
"key": "THE DATA I WANT"
}
}
}
How can i have my data ? I've tried something like this._(and.list.key)
without result.
This is the function to pull in the translated version of a label.
"switch.rules.btwn"
is the key to look up the version of the label in the right language for the user.
See the Internationalisation section of the Node-RED documentation for more details.