Number formatting (thousands separator)

hmm i was looking here
https://docs.oracle.com/cd/E19455-01/806-0169/overview-9/index.html

and separator there looks like space … so question is if java from oracle actually using their definition or whatever.

so so i’ve changed locale to more europian, de_DE and separator is still the same

Number      PVE_Daily           "Today's Yield [%,.0f Wh]"

I guess this interpration simply using , as separator no matter which locale. Or can anybody confirm different result?

If you enter
system:property
on the karaf console, what results do you see for
user.country=
user.language=
This is what I’d expect the formatter to use

user.country=DE
user.country.format=CA
user.language=de
user.language.format=en

strangely there is something .format which i have no idea where to change/how?

humm, looks like the culprit. I had not thought of “sub-settings” at work. The .format version will be used by the formatter only. Seems unlikely it got randomly set to CA. Sorry I do not how to alter, or better remove, these settings. Maybe something in ...openHAB/runtime/bin/setenv

thanks to your hint i was able to find where it is driven
so

user.country=DE
user.language=de
are from /etc/default/locale -> LC_MESSAGE

user.country.format=CA
user.language.format=en
are used from /etc/default/locale -> LANG

so yeah, messed up locales, but ironically messed up by openhabian-config tool :slight_smile:

Sneaky. What was fix, just edit the offending lines, remove them, or re-run the tool?

No openhabian here, presumably why I have no user.xxx.format system settings (and formatter will use the base settings)

fix is pretty easy, just manually update locale and because I want english console but EU numbers etc. I did:

  • Edit /etc/locale.gen and make sure that both en_US.UTF-8 and regional eg. de_DE.UTF-8 are uncommented.
  • Run “sudo locale-gen”
  • Edit /etc/default/locale with this:
LANG=de_DE.UTF-8
LC_MESSAGES=en_US.UTF-8
  • Reboot

fixed
and result from console is

user.country=US
user.country.format=DE
user.language=en
user.language.format=de

and btw OH 2.5 snapshot, dunno if that .format thing is in 2.4 as well

1 Like

Reckon that would work with CA-en and CA-fr :wink:

Well spotted. Will implement as well.

well I think this should not depend on system locale but trully only on OH locale, as many of us are using linux machines as en_US preferably, but end-user apps like OH should act as system independed with their own lang settings

just my two cents ;]

Oookay … so you have a fairly technical non-standard requirement ; and you can achieve that with a technical solution.
Doesn’t sound like a reason to mess up other people’s defaults.

that is not requirement, that’s just general suggestion how it might be done.
it might be quite confusing (as was for me) when you configure OH locale properly but nothing really happends … :wink:

anyway again, only suggestion to think about eventually, if not no big deal really

I did leap to a conclusion that there was something unusual about your installation. So far as we know, it all works as advertised for other people. Mind you, maybe not many have home automation parameters in the thousands :wink:

I recon there is big chunk of people who have PVE on their roofs :stuck_out_tongue:

Sure, but they might use kW or whatever.

In did this with little effect. Is this supposed to work with 2.4.0?

I dont see the .format properties.

dunno really, Iam running 2.5.1 snapshot and as @rossko57 pointed before it looks like it’s not part of 2.4

So, @kriznik you are not the only one.
I am running OH 2.5.5 in a Docker Container and i dont know how to change the country variable.

i tried the following in my docker-compose.yml

environment:
      OPENHAB_HTTP_PORT: "8090"
      OPENHAB_HTTPS_PORT: "8453"
      EXTRA_JAVA_OPTS: "-Duser.country=DE"
      EXTRA_JAVA_OPTS: "-Duser.timezone=Europe/Berlin"

but sadly that doesnt work. The Karaf Console always show “user.country=US”

any advice?

Just in case this is still relevant 2 years after your post: I had the same problem and managed to solve it. See here for a description of what I did.

1 Like