shaonianzhentan / node-red-contrib-ha-mqtt

在HomeAssistant中生成MQTT实体
https://github.com/shaonianzhentan/node-red-contrib-ha-mqtt
MIT License
37 stars 19 forks source link

Revert "English translation" #5

Closed benfiglin closed 2 years ago

benfiglin commented 2 years ago

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).

shaonianzhentan commented 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

benfiglin commented 2 years ago

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.

shaonianzhentan commented 2 years ago

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)
benfiglin commented 2 years ago

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.

shaonianzhentan commented 2 years ago

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