Alarm type l10z in notifications

gustavofarias 3 years ago

I noticed the type of the alarm in notification messages come as raw strings like 'powerCut' instead of 'Power Cut'. Is this expected?
Does the server has a main language that could be used to translate the alert types using the localization resources already used for the GUI?

Anton Tananaev 3 years ago

Which type on notification are we talking about?

gustavofarias 3 years ago

Alarm type notification. Every alarm notification has a subtype, and this subtype string is like I posted before.

#set($subject = "$device.name: alarm!")
$device.name alarm: $position.getString("alarm") at $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.eventTime, $locale, $timezone)

$position.getString("alarm") prints 'powerCut' in both short and full versions.

Anton Tananaev 3 years ago

Currently we don't localize it, but you can update the template to localize the value.

gustavofarias 3 years ago

Do you mean with ifs and elses?

Anton Tananaev 3 years ago

Yes.

Cristian 3 years ago
#set($subject = "$device.name: alarm!")
#if( $position.getString("alarm") == "general" )
#set($alarma = "General")
#elseif( $position.getString("alarm") == "sos" )
#set($alarma = "SOS")
#elseif( $position.getString("alarm") == "vibration" )
#set($alarma = "Vibracion")
.
.
.
#else
#set($alarma = "No Definida")
#end
$device.name alarma: $alarma a las $dateTool.format("YYYY-MM-dd HH:mm:ss", $event.eventTime, $locale, $timezone)

I edited alarm.vm that way and it works fine.

Regards