Multi-language sitemaps and string states

Dear Everyone!

I have an English sitemap now, and I started another one, which will have the same layout as my english one. However, I don’t know how could I localize some rules outputs, etc… So for example I have an Item (String) on this sitemap which prints the current day in string (Monday, Tuesday, etc…). How could I translate this to my language? I thought something like mapping the values on this sitemap, but that doesn’t seem to work.

Any idea?

Thanks

It should work, can you post you items, sitemap and mapping file, please?

I don’t have an exact .map file for that, I thought that it should work with the sitemaps ‘mappings’ operator.

Here is one example:

Default item=Today label="Today is [%1$tA]" icon="time"

and I want something similar in my language sitemap

Default item=Today label="Today is [%1$tA]" icon="time" mappings=["Monday"="Hétfő, "Tuesday", etc...]

I thought that using .map file will map all values to that given value, not? Then I will lose my English sitemap…

The sitemap mappings only work for Switch and Selection element types

https://docs.openhab.org/configuration/sitemaps.html#mappings

Try that, I am not sure it will work but worth a try

Default item=Today label="Today is [MAP(weekday.map):%s]" icon="time"

And a weekday.map file in your transformation folder

NULL=NULL
-=Undefined
Monday=Hétfő
Tuesday=....

Thanks, I’ll try that!!!

I have tried that, it is very interesting that doesn’t give any syntax error or any error at all, it loads the sitemap, but loads the english values…

Try changing Default Item= to Text Item=

It’s worth a try, Iwasn’t sure it would work or not. Sitemap behaviour is weird sometimes. It does what it is meant to do but nothing more.

Failing that you will need to create another item that copy your weekday item but like that:

String Weekday_Hungarian "Today is [MAP(weekday.map):%s]" { same binding as your weekday item if it is a binding }

Changing to Text did not help!
That’s not a problem, I’ll create a new Item. However, I’m not using any binding it’s just a simple rule which returns the date/time. This could be a problem? It not only returns a String…

	Default item=Today label="Local Date and Time [%1$tY.%1$tm.%1$td %1$tH:%1$tM ]" icon="time"
	Default item=Today label="Today is [%1$tA]" icon="time"

I’m using like this…