Transition to i18n and add English translation #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds multi-language support per this document: https://nodered.org/docs/creating-nodes/i18n
As requested in #3, also adds English as the default language, while keeping the Chinese language available and auto-selected for installations with Node Red set up to Chinese.
Most of the translation strings are located in the
locales/[_lang_]/common.json
file, while some are within each individual node folder (only for those nodes that have specific definitions that are not common among the other nodes).I tried to keep anything i18n specific out of the
HomeAssistant.js
file, since I wanted to keep this class/file language-neutral and to only be responsible for constructing and sending MQTT messages to HA, and not for sending language-specific messages back to the Node Red editor.Please review and let me know if I should fix anything.
@emkookmer, I'm mentioning you here since you were interested in this too.