"." as thousand separator in Main UI via State Description / Pattern

I’d like to format a number (total amount of water in liters) in Main UI as 7.301 Liter (as in: 7 thousand 145 liter). Currently it’s shown as 7,301 Liter.
image

I’m using a stateDescription to format it (currently: %, .0f Liter). Changing it to %. .0f Liter instead results in gibberish.

Question is: What do I have to do?

My local raspi is set (under raspi-config) to the profile de_DE.UTF-8
image

Changing the openHAB Regional Setting to “German” (though I’d like to have openHAB in English) doesn’t make a difference.

Any ideas?

Update: Read through this thread here Number formatting (thousands separator) - #28 by Simsala , but am a bit hesitant, since the thread is rather old and maybe I’m just doing something wrong.

The “print” formatting is done by Java utilities, so it is the Java locale options that you need to set, as per the thread that you found.

Assuming you run openHABian, please update to latest and use menu 32 to re-set the locale and let me know if that fixes it.

I’m running openHAB on Docker, not openHABian.

Will try @rossko57’s hint and report back.

Java, unless instructed different, should reuse the system locale settings so it’s rather about getting those right.

Thanks a lot for all the hints!

So just to double-check, to not mess up the wrong parameter, before I keep messing around with internals:

  1. My raspi-config is set to the profile de_DE.UTF-8Ok from what I can see.
    image

  2. In my openHAB "Regional Settings, the measurement system is set to “metric” and language is “English” → Ok from what I can see.

  3. In the karaf-console, as mentioned here, the reading user.country is the one I have to change as described in the post, if I want to keep openHAB’s language as “English” and the number formating with “.” as thousand separator. Correct?

user.country=US
user.dir=/openhab/userdata
user.home=/openhab
user.language=en
user.name=openhab
user.timezone=Europe/Berlin

Observation: Strangely I do not see any entries with something .format.

read more carefully (“zu generierende Locales”)

again read more carefully : country (i.e. locale) is DE

Thanks for all the hints. I managed to solve the problem myself based on the hints above.

Fun fact: My case illustrates how important it is to state the overall setting in which you’re operating in when opening a new post here in this forum: Since I’m running on docker (but forgot to mention this), raspi-config doesn’t even play a role, since this changes the Raspbian-variables, and the ones that are relevant for openHAB are (in my case) the ones of the docker container and thus defined in my docker-compose.yml. As a result the problem is also fairly easy to fix.

Here’s what I did to solve the problem:

  1. Access terminal of the openHAB docker container via docker exec -t -i openhab /bin/bash
  2. Typing locale proves that the reason why “,” is used as a thousand separator in openHAB is because all variables of the openHAB container are set to default (here: ```
    en_US.UTF-8):
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
  1. In the docker-compose.yml I added the following to the “environment:”-chapter
LANG: de_DE.UTF-8
LANGUAGE: de_DE.UTF-8
LC_ALL: de_DE.UTF-8
  1. “Update the stack” (I’m using Portainer)

Problem solved. :slight_smile:
image

Thanks for everyone involved.