fellinga / node-red-contrib-ui-time-scheduler

Easily power on/off any kind of device based on a schedule that you can easily create at the node-red-dashboard frontend.
MIT License
37 stars 15 forks source link

Change of language #66

Closed PandCall closed 2 years ago

PandCall commented 2 years ago

Hi, I can't change the language of the node. I understood that it was happening in the .node-red/node_modules/node-red-contrib-ui-time-scheduler/locales/xx_xxx/time-scheduler.json with correct locales folders I tested fr_FR or fr_FR.UTF-8 but it is still in English. I must be forgetting something. What mechanism is used to change the language of the node? after translating the time-scheduler.json file how to implement it ? Best regards

System : Raspberry with Buster Node-Red : 2.1.3 node-red-contrib-ui-time-scheduler 1.16.2

Locale LANG=fr_FR.UTF-8 LANGUAGE= LC_CTYPE="fr_FR.UTF-8" LC_NUMERIC="fr_FR.UTF-8" LC_TIME="fr_FR.UTF-8" LC_COLLATE="fr_FR.UTF-8" LC_MONETARY="fr_FR.UTF-8" LC_MESSAGES="fr_FR.UTF-8" LC_PAPER="fr_FR.UTF-8" LC_NAME="fr_FR.UTF-8" LC_ADDRESS="fr_FR.UTF-8" LC_TELEPHONE="fr_FR.UTF-8" LC_MEASUREMENT="fr_FR.UTF-8" LC_IDENTIFICATION="fr_FR.UTF-8" LC_ALL=

fellinga commented 2 years ago

Hi @PandCall,

all the UI nodes automatically select the language of the node-red instance that is currently running.

You can set the language here (settings.js file): https://github.com/node-red/node-red/blob/3e0f080ea7511bbf242a079d3f504e266c6d04e1/packages/node_modules/node-red/settings.js#L233

Unfortunately FR is not in the list yet and I suppose it will default to EN-US if you change it to FR and as long as node-red does not run in FR mode the UI scheduler will not load the FR translation file. I can only see two possible solutions - contribute to the node-red core, so that FR is going to be available or just replace the content of "node-red/node_modules/node-red-contrib-ui-time-scheduler/locales/en-US/time-scheduler.json" with french values.

Please let me know if this helps!

PandCall commented 2 years ago

Thank you for your quick answer, I understand better the constraints. The workaround I found is to translate the files that are into en-US It's a bit radical as a solution, but for the moment it's effective. For this application, it's 100% French, so it's not a problem not to have multi-languages. Time to find something more dynamic. Best regards

fellinga commented 2 years ago

Thanks for your feedback. Going to close this issue, let me know if you need anything else!

PandCall commented 2 years ago

Thanks for your help, for the moment it's ok but I will also follow the track to modify Node-Red to apply dynamically the language. in /usr/lib/node_modules/node-red/node_modules/@node-red/editor-client/locales/ creation of a fr-FR folder to make Node-Red believe it is in French :) To Be Continued........