How to display localized strings?

I’m trying to display a dayname on a webview using my local language, however I get the day only in english??

My codde-line (sing a channel of the weather binding) in the HTML is:

${forecast(1):condition.observationTime(%1$tA)}

My raspi is set to “de_DE.UTF-8 UTF-8”

Are you sure that this applies also to root and openhab user?

??
I didn’t even know that this is user dependant!
Will check that, thanks for that input.

I had a similar problem in openhab 1.x, I fixed it with setting this in /etc/default/openhab:

Extra arguments passed to Java

JAVA_ARGS=’-Duser.language=nl -Duser.country=NL’

Don’t know if this also applies to openhab 2

1 Like

I did set de_DE.UTF-8 UTF-8 using “sudo raspi-config”. IMHO that way the setting is used by all users.

Thanks @pensionado, that change made it work (with the change to my language :wink:)!

Yes, this is definitely user dependend. Even if you have setup through sudo raspi-config, this would surely be done for pi and future users, but I’m quite sure, not for any other existing user. you could set the locales before starting openHAB using this line:

export LC_ALL=de_DE.UTF-8

in the start script.

I have to revive this old thread of mine:
I observed that the localisation of the daynames isn’t working anymore (since when???).
I applied both above methods, however the outcome doesn’t change!

Did you setup the language through Paper UI or runtime.cfg yet? There are options for that part…

I have set the region to language de country DE in PaperUI.

I see the problem on Webpage which I convert to a picture before showing it on the sitemap, maybe the problem is due to that.

Can’t even get a Text Item to show the localised name.

Text item=ObservationWeekDay1 label="[%1$tA]"

The item is defined as a DateTime!
Does show “Saturday” instead of the desired ""Samstag "

Please try to get the local settings for the user openhab:

sudo su -s /bind/bash openhab

Should open a bash for user openhab, even if the bash is set to /bin/false.

Now take a look at locale

Another thing would be to take a look at /etc/default/locale,
this is mine:

#  File generated by update-locale
LC_ALL=de_DE.UTF-8
LANG=de_DE.UTF-8

In fact, I did an edit on this file :slight_smile: but openhab gives me german Weekdays all the time (now OH2.2 #1088)

1 Like

On the bash, I got an “no such file”.

I changed the other file and it is working now. Thanks again.
Reading the comment on your file,I might have missed to change the locale on the system.

I can confirm, that setting locale with openhabian-config does not work!
openHAB 2.3.0-1 (Release Build)

Editing /etc/default/locale by hand and reboot sets everything correct.

Please report this issue on github https://github.com/openhab/openhabian

There is an old issue which is marked as solved https://github.com/openhab/openhabian/issues/59