openhab / openhabian

openHABian - empowering the smart home, for Raspberry Pi and Debian systems
https://community.openhab.org/t/13379
ISC License
818 stars 251 forks source link

java locale ? #1721

Closed mstormi closed 1 year ago

mstormi commented 1 year ago

java needs to be run with -D options to have the proper locale in order to have OH display item states in the proper format (e.g. "," instead of "." as a separator behind the integer part of a number). This may or may not be a problem in current openHABian but needs to be checked and changed, eventually. If so derive proper setting from the OS locale setting ?

EXTRA_JAVA_OPTS: "-Duser.country=DE" EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"

florian-h05 commented 1 year ago

proper locale in order to have OH display item states in the proper format (e.g. "," instead of "." as a separator behind the integer part of a number).

I had the same problem a few days ago, but ...

This may or may not be a problem in current openHABian

This is a problem of the current openHABian, I also had this some time ago. I identified that it's a problem with the system locales, and not java. See https://github.com/openhab/openhabian/issues/1718.

I fixed it in https://github.com/openhab/openhabian/pull/1719.

I just checked my EXTRA_JAVA_OPTS in /etc/default/openhab and I have nothing set there, so the problem was definitely related to the system locales, after I set the locales correctly, openHAB used the proper locale.

mstormi commented 1 year ago

thanks for explaining and fixing

mstormi commented 1 year ago

Just hitting this again myself. Thing is, system_default_locale was the openhabian.conf parameter to set locale on unattended installs. It now doesn't work any more. While current code is fine when system_default_locale is unset, it should be honored when set.

florian-h05 commented 1 year ago

Oops, I was not aware of this. I think it should be fine if we check for INTERACTIVE or UNATTENED mode and then use system_default_locale only if we are in UNATTENDED. I‘ll provide a fix later.