Merge pull request #375 from Bijnagte/notify-me-when-i18n-events

add event translation
This commit is contained in:
Dylan Bijnagte
2016-02-16 14:39:29 -06:00
2 changed files with 76 additions and 39 deletions

View File

@@ -0,0 +1,31 @@
'''Acceleration Detected'''.ko=가속화 감지됨
'''Arrival Of'''.ko=도착
'''Both Push and SMS?'''.ko=푸시 메시지와 SMS를 모두 사용하시겠습니까?
'''Button Pushed'''.ko=버튼이 눌렸습니다
'''Contact Closes'''.ko=접점 닫힘
'''Contact Opens'''.ko=접점 열림
'''Departure Of'''.ko=출발
'''Message Text'''.ko=문자 메시지
'''Minutes'''.ko=
'''Motion Here'''.ko=동작
'''Phone Number (for SMS, optional)'''.ko=휴대전화 번호(문자 메시지 - 옵션)
'''Receive notifications when anything happens in your home.'''.ko=집 안에 무슨 일이 일어나면 알림이 전송됩니다.
'''Smoke Detected'''.ko=연기가 감지되었습니다
'''Switch Turned Off'''.ko=스위치 꺼짐
'''Switch Turned On'''.ko=스위치 꺼짐
'''Choose one or more, when...'''.ko=다음의 경우 하나 이상 선택
'''Yes'''.ko=
'''No'''.ko=아니요
'''Send this message (optional, sends standard status message if not specified)'''.ko=이 메시지 전송(선택적, 지정되지 않은 경우 표준 상태 메시지를 보냅니다)
'''Via a push notification and/or an SMS message'''.ko=푸시 알림 및/또는 문자 메시지를 통해
'''Set for specific mode(s)'''.ko=특정 모드 설정
'''Tap to set'''.ko=눌러서 설정
'''Minimum time between messages (optional, defaults to every message)'''.ko=메시지작 간 최소 시간(선택 사항, 모든 메시지의 기본 설정)
'''If outside the US please make sure to enter the proper country code'''.ko=미국 이외 거주자는 적절한 국가 코드를 입력했는지 확인하십시오
'''Water Sensor Wet'''.ko=Water Sensor에서 물이 감지되었습니다
'''{{ triggerEvent.linkText }} has arrived at the {{ location.name }}'''.ko={{ triggerEvent.linkText }}님이 {{ location.name }}에 도착했습니다
'''{{ triggerEvent.linkText }} has arrived at {{ location.name }}'''.ko={{ triggerEvent.linkText }}님이 {{ location.name }}에 도착했습니다
'''{{ triggerEvent.linkText }} has left the {{ location.name }}'''.ko={{ triggerEvent.linkText }}님이 {{ location.name }}을(를) 떠났습니다
'''{{ triggerEvent.linkText }} has left {{ location.name }}'''.ko={{ triggerEvent.linkText }}님이 {{ location.name }}을(를) 떠났습니다
'''Assign a name'''.ko=이름 배정
'''Choose Modes'''.ko=모드 선택

View File

@@ -99,49 +99,55 @@ def eventHandler(evt) {
} }
private sendMessage(evt) { private sendMessage(evt) {
def msg = messageText ?: defaultText(evt) String msg = messageText
Map options = [:]
if (!messageText) {
msg = defaultText(evt)
options = [translatable: true, triggerEvent: evt]
}
log.debug "$evt.name:$evt.value, pushAndPhone:$pushAndPhone, '$msg'" log.debug "$evt.name:$evt.value, pushAndPhone:$pushAndPhone, '$msg'"
if (location.contactBookEnabled) { if (location.contactBookEnabled) {
sendNotificationToContacts(msg, recipients) sendNotificationToContacts(msg, recipients, options)
} } else {
else { if (!phone || pushAndPhone != 'No') {
log.debug 'sending push'
if (!phone || pushAndPhone != "No") { options.method = 'push'
log.debug "sending push" //sendPush(msg)
sendPush(msg)
} }
if (phone) { if (phone) {
log.debug "sending SMS" options.phone = phone
sendSms(phone, msg) log.debug 'sending SMS'
//sendSms(phone, msg)
} }
sendNotification(msg, options)
} }
if (frequency) { if (frequency) {
state[evt.deviceId] = now() state[evt.deviceId] = now()
} }
} }
private defaultText(evt) { private defaultText(evt) {
if (evt.name == "presence") { if (evt.name == 'presence') {
if (evt.value == "present") { if (evt.value == 'present') {
if (includeArticle) { if (includeArticle) {
"$evt.linkText has arrived at the $location.name" '{{ triggerEvent.linkText }} has arrived at the {{ location.name }}'
} }
else { else {
"$evt.linkText has arrived at $location.name" '{{ triggerEvent.linkText }} has arrived at {{ location.name }}'
} }
} } else {
else {
if (includeArticle) { if (includeArticle) {
"$evt.linkText has left the $location.name" '{{ triggerEvent.linkText }} has left the {{ location.name }}'
} }
else { else {
"$evt.linkText has left $location.name" '{{ triggerEvent.linkText }} has left {{ location.name }}'
} }
} }
} } else {
else { '{{ triggerEvent.descriptionText }}'
evt.descriptionText
} }
} }