Custom UI node translation

I am currently trying to translate my custom UI node and there are some things that I just can't figure out.

  1. How do I add translation to the nodes defaults in myNode.html? The following does not work:
defaults: {
            name: {value: ''},
            devices: {value: [RED._("time-scheduler.ui.device")]},
            outputs: {value: 2},

"devices " should be an array containing one string.

  1. I also added translation to myNode.js, using:
RED._("myNode.myText") 

This works fine for English but it also displays everything in English (locales/en-US/myNode.json) if the device should receive German (locales/DE/myNode.json) translations. Backend translations to German from the same file are working well though.

  1. What is the preferred way to add i18n support to a UI nodes scope?

I just released an update of my contrib-ui-node and wanted to share the github code so that everyone can see what I mean.

1 - how would I translate "Device1":

2 - whole UI only translates to EN:

3 - works but probably not the best solution

1 Like

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