Closed benfiglin closed 2 years ago
You deleted publish_ state method, so that translation text needs to be passed in everywhere
What I think is that the translation content is all carried out in homeassistant.js
Not sure I understand what you meant.
PR #5 reverts PR #4 (which was incomplete and had many issues).
I'm working on a better solution that will take all language text out of homeassistant.js and let Node Red manage the language selection in the nodes based on what language Node Red is set to.
I know what you mean, I think it will be easier to pass RED into the HomeAssistant instance
const ha = new HomeAssistant(this, cfg, RED)
Are you referring to my branch "English-translation"? This branch is still work in progress.
I started by doing that exactly like you mentioned, but it was a bit convoluted and ugly because homeassistant.js is not technically part of the Node Red nodes. I'm trying to keep all translation related things in the nodes themselves. But I'm open to suggestions.
yes
homeassistant.js is the core of all nodes,I don't need to care about the node itself, The logic is all in homeassistant.js
Reverts shaonianzhentan/node-red-contrib-ha-mqtt#4
As I stated in the comments. this PR is not good and has many breaking changes. (Since I'm not the one who opened PR #4, I could not close it)
I will post a better PR in a couple of days that will introduce Node Red's internationalization (https://nodered.org/docs/creating-nodes/i18n) and will work for both Chinese and English (and other languages in the future as well).