-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[nikohomecontrol] Prepare for translation #11319
Conversation
mherwege
commented
Sep 28, 2021
•
edited
Loading
edited
- Externalize strings to properties file to allow translation as a next step.
- Give listener thread a name.
- Fixed SAT warning
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Signed-off-by: Mark Herwege <[email protected]>
Please look at other bindings how they defined translations for thing type label/description or config parameter label/description. There is no need to add |
And please note that you did not use strictly the recommended thread name convention. The threads name should start by "OH-binding-" followied by the thing UID and optionally followed by an additional specific part in case you create several threads for the same thing. |
@lolodomo Thank you for looking into this. I am well aware I do not strictly need the @text in my thing files. But if I understood well from #10635, I would then need to replicate all strings anyway for them to be picked up by Crowdin. I consider that prone to error when one makes a change and forgets to keep them in sync. Therefore I opted for the @text construct. |
@lolodomo, thank you for noticing, I didn’t look far enough in my research and will correct. Done |
Signed-off-by: Mark Herwege <[email protected]>
@cweitkamp : can you confirm that is the new way to go for all bindings ?! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review comments excluding all stuff with @text
I have now like a doubt that this binding implemented a proper bridge/thing handling.
.../java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlActionHandler.java
Outdated
Show resolved
Hide resolved
.../java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlActionHandler.java
Show resolved
Hide resolved
.../java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlActionHandler.java
Show resolved
Hide resolved
.../java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlActionHandler.java
Outdated
Show resolved
Hide resolved
.../java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlActionHandler.java
Outdated
Show resolved
Hide resolved
...a/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlThermostatHandler.java
Outdated
Show resolved
Hide resolved
...a/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlThermostatHandler.java
Show resolved
Hide resolved
...a/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlThermostatHandler.java
Outdated
Show resolved
Hide resolved
...a/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlThermostatHandler.java
Outdated
Show resolved
Hide resolved
...rg/openhab/binding/nikohomecontrol/internal/protocol/nhc1/NikoHomeControlCommunication1.java
Outdated
Show resolved
Hide resolved
https://www.openhab.org/docs/concepts/things.html#thing-status
|
According to our documentation this is a valid way to define translatable phrases. There are other bindings which are already designed in this way. There are no strict guidelines for the future way of localization and thus it is up to the developers to choose their favorite path. From my POV @mherwege arguments for his decision are strong and I personally agree on his opinion. |
I don't really like this choice being dictated by a tool (Crowdin) and the fact that we have 2 different ways of doing it, but if this is compliant with our coding rules, I will review (and approve) this part too. Thank you for the answer. |
Signed-off-by: Mark Herwege <[email protected]>
@lolodomo Thank you for your review. I believe I have fixed all thing lifecycle issues. Can you review again? |
I believe the build failure is not related to the binding. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please avoid redundant calls to updateStatus
.
I see something wrong in your thing handlers initialize(): you are checking the bridge status at the very end, even in the separate thread you are scheduling. In fact, it should be the first thing you should check at the beginning of the method initialize.
.../java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlActionHandler.java
Outdated
Show resolved
Hide resolved
.../java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlActionHandler.java
Outdated
Show resolved
Hide resolved
.../java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlActionHandler.java
Outdated
Show resolved
Hide resolved
.../org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlEnergyMeterHandler.java
Show resolved
Hide resolved
.../org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlEnergyMeterHandler.java
Outdated
Show resolved
Hide resolved
.../org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlEnergyMeterHandler.java
Outdated
Show resolved
Hide resolved
.../org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlEnergyMeterHandler.java
Outdated
Show resolved
Hide resolved
...a/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlThermostatHandler.java
Outdated
Show resolved
Hide resolved
...a/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlThermostatHandler.java
Outdated
Show resolved
Hide resolved
...a/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlThermostatHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Mark Herwege <[email protected]>
Sorry, I missed your review earlier. Thank you for the feedback.
I have removed these.
I am a bit reluctant to touch this. It has been working well for many years for myself and other users. I made a few changes while doing the preparation to allow for translation, but this is becoming much bigger than anticipated. And that comes with added risk. I value your input, and it does make sense. But I don't want to risk destroying a working system. |
I agree that it could be changed in a separate PR, especially if this is currently working well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last thing to be fixed
.../java/org/openhab/binding/nikohomecontrol/internal/handler/NikoHomeControlActionHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Mark Herwege <[email protected]>
@lolodomo Many thanks for you torough review effort. I believe I have covered all your remarks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Externalize strings to support translation Signed-off-by: Mark Herwege <[email protected]> * Name events thread. Signed-off-by: Mark Herwege <[email protected]> * Fix formatting Signed-off-by: Mark Herwege <[email protected]> * Fix SAT warning Signed-off-by: Mark Herwege <[email protected]> * Fix threadname Signed-off-by: Mark Herwege <[email protected]> * Fix thing lifecycle. Signed-off-by: Mark Herwege <[email protected]> * Adjustments from review. Signed-off-by: Mark Herwege <[email protected]> * Adjustment from review. Signed-off-by: Mark Herwege <[email protected]> Signed-off-by: Dave J Schoepel <[email protected]>
* Externalize strings to support translation Signed-off-by: Mark Herwege <[email protected]> * Name events thread. Signed-off-by: Mark Herwege <[email protected]> * Fix formatting Signed-off-by: Mark Herwege <[email protected]> * Fix SAT warning Signed-off-by: Mark Herwege <[email protected]> * Fix threadname Signed-off-by: Mark Herwege <[email protected]> * Fix thing lifecycle. Signed-off-by: Mark Herwege <[email protected]> * Adjustments from review. Signed-off-by: Mark Herwege <[email protected]> * Adjustment from review. Signed-off-by: Mark Herwege <[email protected]> Signed-off-by: Nick Waterton <[email protected]>
* Externalize strings to support translation Signed-off-by: Mark Herwege <[email protected]> * Name events thread. Signed-off-by: Mark Herwege <[email protected]> * Fix formatting Signed-off-by: Mark Herwege <[email protected]> * Fix SAT warning Signed-off-by: Mark Herwege <[email protected]> * Fix threadname Signed-off-by: Mark Herwege <[email protected]> * Fix thing lifecycle. Signed-off-by: Mark Herwege <[email protected]> * Adjustments from review. Signed-off-by: Mark Herwege <[email protected]> * Adjustment from review. Signed-off-by: Mark Herwege <[email protected]>
* Externalize strings to support translation Signed-off-by: Mark Herwege <[email protected]> * Name events thread. Signed-off-by: Mark Herwege <[email protected]> * Fix formatting Signed-off-by: Mark Herwege <[email protected]> * Fix SAT warning Signed-off-by: Mark Herwege <[email protected]> * Fix threadname Signed-off-by: Mark Herwege <[email protected]> * Fix thing lifecycle. Signed-off-by: Mark Herwege <[email protected]> * Adjustments from review. Signed-off-by: Mark Herwege <[email protected]> * Adjustment from review. Signed-off-by: Mark Herwege <[email protected]>