translate alarm events

Josue 8 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 Tananaev 8 years ago

You can translate template files.

gustavofarias 8 years ago

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

Anton Tananaev 8 years ago

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

gustavofarias 8 years ago

Could you tell us where this mapping expression should go?

Anton Tananaev 8 years ago

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

Josue 8 years ago

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

Anton Tananaev 8 years ago

Something like this:

#{if}($position.getString("alarm").equals("powercut"))LOCALISED POWER CUT#{else}OTHER ALARM#{end}
Andreas Kern 6 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!

Santiago 6 years ago

Did you manage to solve how to translate multiple alarms?

Andreas Kern 6 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 Kern 6 years ago

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

#{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.