translate alarm events

Josue7 years ago

hi Anton. i have devices that uses gt06 and gps103 protocols
how can i translate or change name alarm events that is sending by sms and email for example
"shock" "door" "powerCut" "poweroff" "poweron" ?? it seems that default names cant be changed, nevertheless the other alarms could translate to spanish.

Anton Tananaev7 years ago

You can translate template files.

gustavofarias7 years ago

In this case the template doesn't help.
This is what is in the template: Alarm: $position.getString("alarm")

Anton Tananaev7 years ago

It does help. You can write expression to map alarm key to a translated word or phrase.

gustavofarias7 years ago

Could you tell us where this mapping expression should go?

Anton Tananaev7 years ago

It should go in place of the code that you showed.

Josue7 years ago

in case of "powercut" alarm, could you show an example how could it be?

Anton Tananaev7 years ago

Something like this:

#{if}($position.getString("alarm").equals("powercut"))LOCALISED POWER CUT#{else}OTHER ALARM#{end}
Andreas Kern4 years ago

Hello,
i want to tie in the post because i want to evaluate more conditions to translate more alarm types.

For example:

#{if}($position.getString("alarm").equals("powercut"))LOCALISED POWER CUT
#{else if}($position.getString("alarm").equals("sos"))SOS BUTTON WAS PUSHED!!!
#{else}OTHER ALARM#{end}

When i entered this syntax,

following message was sent:

LOCALISED POWER CUT# #{else if}(false)SOS BUTTON WAS PUSHED!!!

How can i solve this problem?

Thanks in advance!

Santiago4 years ago

Did you manage to solve how to translate multiple alarms?

Andreas Kern4 years ago

Hello Santiago,

sorry for my late answer.
I am sorry to say that i did not solve the problem yet.
I hoped to get some help here on the forum.

Andreas Kern4 years ago

Here is the solution how to get multiple translations to alarms:

#{if}($position.getString("alarm").equals("powercut"))LOCALISED POWER CUT #{elseif}($position.getString("alarm").equals("sos"))SOS BUTTON WAS PUSHED!!! #{else}OTHER ALARM#{end}

The else if condition has to be written without space.
{elseif} is the right writing.