Question on channel format in new bindings

I have been working on tuning up a forum binding for possible inclusion in addons. I don’t have any formal java training, but am making progress. One thing I noticed was a reference to this;
Channel id: lower-case-hyphen`

However on a quick review there are a lot of channels in existing bindings with lower_case or lowerCase or lowercase, not a lot of lower-case. Before I go changing anything I want to check that hyphen means “-”, not “_” or can it be either?

Also for clarity in the i18n properties are the hyphens (or underscores) then removed? I’m assuming they need to match?
example Current: channel-type.mideaac.childSleepMode.label = Child sleep mode

does this mean channel-type.mideaac.childsleepmode.label = Child sleep mode or
channel-type.mideaac.child-sleep-mode.label = Child sleep mode
or channel-type.mideaac.child_sleep_mode.label = Child sleep mode

Sorry for being dense, but I don’t want to do this twice.

The naming conventions for this are still relatively new:

So please use these for new add-ons. Updating existing add-ons for this is a breaking change so only do that when there are lots of other breaking changes.

Yes a hyphen is -.
A _ is an underscore.

Yes they need to match but it is easier to generate the default translations file using the Maven plugin:

That saves time and prevents mistakes. :slight_smile:

Sorry to hijack this topic, but I’ve noticed that this tool doesn’t generate translations (.properties) file for transformations. It only works for bindings.

It does generate them but the translations for profiles seem to be missing so I’ve created openhab-core#4362 for this.

Thanks. Besides the diversity in the current addons I was concerned there might be some difference across the “pond” between these. Also since - can’t be used with items it seemed odd to use with channels. It will be a breaking change for current testers, but I’ll create a separate branch for the PR. Again thanks also for the tip on language. I had tried google translate, but wasn’t sure of the result.

1 Like