# Custom UI node translation

**URL:** https://discourse.nodered.org/t/custom-ui-node-translation/34836
**Category:** Developing Nodes
**Created:** [26 October 2020 15:22 UTC](https://discourse.nodered.org/t/custom-ui-node-translation/34836 "2020-10-26T15:22:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![fellinga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fellinga/32/30631_2.png) [@fellinga](https://discourse.nodered.org/u/fellinga)
#### Post date: [26 October 2020 15:22 UTC](https://discourse.nodered.org/t/custom-ui-node-translation/34836/1 "2020-10-26T15:22:38Z")

</div>

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:

```auto
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:

```auto
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?

---

<div class="post-metadata">

### Author: ![fellinga](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/fellinga/32/30631_2.png) [@fellinga](https://discourse.nodered.org/u/fellinga)
#### Post date: [5 November 2020 20:05 UTC](https://discourse.nodered.org/t/custom-ui-node-translation/34836/2 "2020-11-05T20:05:35Z")

</div>

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":

> <https://github.com/fellinga/node-red-contrib-ui-time-scheduler/blob/668738eb70f35969143a1248fb0b88719614fcad/time-scheduler.html#L56-L60>

2 - whole UI only translates to EN:

> <https://github.com/fellinga/node-red-contrib-ui-time-scheduler/blob/668738eb70f35969143a1248fb0b88719614fcad/time-scheduler.js#L95-L97>

3 - works but probably not the best solution

> <https://github.com/fellinga/node-red-contrib-ui-time-scheduler/blob/668738eb70f35969143a1248fb0b88719614fcad/time-scheduler.js#L181-L183>

---

<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: [4 January 2021 20:05 UTC](https://discourse.nodered.org/t/custom-ui-node-translation/34836/3 "2021-01-04T20:05:37Z")

</div>

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