# Change the email language in the email pipeline from English to Chinese based on the selected language

**URL:** <https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [April 22, 2025, 5:12pm UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418 "2025-04-22T17:12:55Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![abhijit.jagtap](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@abhijit.jagtap](https://forum.inductiveautomation.com/u/abhijit.jagtap)\
**Post date:** [April 22, 2025, 5:12pm UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/1 "2025-04-22T17:12:55Z")

</div>

Change the email language in the email pipeline from English to Chinese based on the selected language.  
I have added a script before the alarm notification block and written the script below.

```python

# Step 1: Get the locale (defaults to 'en' if not set)
locale = alarmEvent.get("locale") or "en"

# Step 2: Extract common alarm event values
displayPath = alarmEvent.get("displayPath", "")
eventTime = system.date.format(alarmEvent.get("eventTime"), "dd:MM:yyyy - HH:mm:ss")
priority = alarmEvent.get("priority", "")
setpoint = alarmEvent.get("SetpointA", "")
eventValue = alarmEvent.get("eventValue", "")
eventState = alarmEvent.get("eventState", "")

# Step 3: Create localized HTML email body
if locale == "zh":
    emailBody = u"""
    <html>
        <body>
            <h3>标题: COE 报警通知</h3>
            <p>有一个报警已被触发，详情如下：</p>
            <ul>
                <li><strong>描述:</strong> {displayPath}</li>
                <li><strong>事件时间:</strong> {eventTime}</li>
                <li><strong>报警类型:</strong> {priority}</li>
                <li><strong>设定值:</strong> {setpoint}</li>
                <li><strong>事件值:</strong> {eventValue}</li>
                <li><strong>状态变化:</strong> {eventState}</li>
            </ul>
            <p>请采取相应的措施。</p>
            <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">点击此处确认报警</a>
            <p>此致敬礼，<br>COE SCADA 系统</p>
        </body>
    </html>
    """.format(
        displayPath=displayPath,
        eventTime=eventTime,
        priority=priority,
        setpoint=setpoint,
        eventValue=eventValue,
        eventState=eventState
    )
else:
    emailBody = """
    <html>
        <body>
            <h3>Title: COE Alarm Notification</h3>
            <p>An alarm has been triggered. Please find the details below:</p>
            <ul>
                <li><strong>Description:</strong> {displayPath}</li>
                <li><strong>Event Time:</strong> {eventTime}</li>
                <li><strong>Alarm Type:</strong> {priority}</li>
                <li><strong>Setpoint Value:</strong> {setpoint}</li>
                <li><strong>Event Value:</strong> {eventValue}</li>
                <li><strong>Transitioned:</strong> {eventState}</li>
            </ul>
            <p>Please take action accordingly.</p>
            <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">Click here for Alarm Ack</a>
            <p>Best Regards,<br>COE SCADA System</p>
        </body>
    </html>
    """.format(
        displayPath=displayPath,
        eventTime=eventTime,
        priority=priority,
        setpoint=setpoint,
        eventValue=eventValue,
        eventState=eventState
    )

# Step 4: Store it in pipelineVars to be used in Email Notification block
pipelineVars["emailBody"] = emailBody

```

After that, I have added the notification pipeline. In the notification pipeline message section, I passed the parameter `{emailBody}`

 ![22](https://us1.discourse-cdn.com/inductiveautomation/original/3X/7/f/7f4906156b7dd3a5344f3d3faab8506dc42d1562.png)  
 ![222](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/d/0dcd5dec3494d6cd9521d8de3110a847f304e1f3.png)  
 ![456](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/4/6475162487bf371d473e15584770509420d8cf6c.png)

Now, my email is sent, but it passes NULL data. If I remove the script and pass the message in HTML format, it sends the message accurately. However, we require the message in multiple languages. What can I do?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 22, 2025, 5:30pm UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/2 "2025-04-22T17:30:09Z")

</div>

Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). Can you edit your question to fix the code? Thanks.

---

<div class="post-metadata">

**Author:** ![abhijit.jagtap](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@abhijit.jagtap](https://forum.inductiveautomation.com/u/abhijit.jagtap)\
**Post date:** [April 23, 2025, 4:59am UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/3 "2025-04-23T04:59:52Z")

</div>

```
	# Step 1: Get the locale (defaults to 'en' if not set)
	locale = alarmEvent.get("locale") or "en"
	
	# Step 2: Extract common alarm event values
	displayPath = alarmEvent.get("displayPath", "")
	eventTime = system.date.format(alarmEvent.get("eventTime"), "dd:MM:yyyy - HH:mm:ss")
	priority = alarmEvent.get("priority", "")
	setpoint = alarmEvent.get("SetpointA", "")
	eventValue = alarmEvent.get("eventValue", "")
	eventState = alarmEvent.get("eventState", "")
	
	# Step 3: Create localized HTML email body
	if locale == "zh":
	    emailBody = u"""
	    <html>
	        <body>
	            <h3>标题: COE 报警通知</h3>
	            <p>有一个报警已被触发，详情如下：</p>
	            <ul>
	                <li><strong>描述:</strong> {displayPath}</li>
	                <li><strong>事件时间:</strong> {eventTime}</li>
	                <li><strong>报警类型:</strong> {priority}</li>
	                <li><strong>设定值:</strong> {setpoint}</li>
	                <li><strong>事件值:</strong> {eventValue}</li>
	                <li><strong>状态变化:</strong> {eventState}</li>
	            </ul>
	            <p>请采取相应的措施。</p>
	            <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">点击此处确认报警</a>
	            <p>此致敬礼，<br>COE SCADA 系统</p>
	        </body>
	    </html>
	    """.format(
	        displayPath=displayPath,
	        eventTime=eventTime,
	        priority=priority,
	        setpoint=setpoint,
	        eventValue=eventValue,
	        eventState=eventState
	    )
	else:
	    emailBody = """
	    <html>
	        <body>
	            <h3>Title: COE Alarm Notification</h3>
	            <p>An alarm has been triggered. Please find the details below:</p>
	            <ul>
	                <li><strong>Description:</strong> {displayPath}</li>
	                <li><strong>Event Time:</strong> {eventTime}</li>
	                <li><strong>Alarm Type:</strong> {priority}</li>
	                <li><strong>Setpoint Value:</strong> {setpoint}</li>
	                <li><strong>Event Value:</strong> {eventValue}</li>
	                <li><strong>Transitioned:</strong> {eventState}</li>
	            </ul>
	            <p>Please take action accordingly.</p>
	            <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">Click here for Alarm Ack</a>
	            <p>Best Regards,<br>COE SCADA System</p>
	        </body>
	    </html>
	    """.format(
	        displayPath=displayPath,
	        eventTime=eventTime,
	        priority=priority,
	        setpoint=setpoint,
	        eventValue=eventValue,
	        eventState=eventState
	    )
	
	# Step 4: Store it in pipelineVars to be used in Email Notification block
	pipelineVars["emailBody"] = emailBody

```

####### In Alarm notification (Massage) i have write below code.

{emailBody}

---

<div class="post-metadata">

**Author:** ![Marcus\_Sysum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/marcus_sysum/32/57944_2.png) [@Marcus\_Sysum](https://forum.inductiveautomation.com/u/Marcus_Sysum)\
**Post date:** [April 23, 2025, 7:37pm UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/4 "2025-04-23T19:37:09Z")

</div>

in your script pipelineVars is local to this script so the email notification block does not have access to this. Try setting the email Body like this `event.setGlobal("emailBody", emailBody)` Then in your notification block you can reference the email body like above as `{emailBody}`

---

<div class="post-metadata">

**Author:** ![abhijit.jagtap](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@abhijit.jagtap](https://forum.inductiveautomation.com/u/abhijit.jagtap)\
**Post date:** [April 24, 2025, 8:35am UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/5 "2025-04-24T08:35:05Z")

</div>

# Get locale (default to English)

locale = alarmEvent.get("locale", "en")

# Extract alarm values

displayPath = alarmEvent.get("displayPath", "")  
eventTime = system.date.format(alarmEvent.get("eventTime"), "dd:MM:yyyy - HH:mm:ss")  
priority = alarmEvent.get("priority", "")  
setpoint = alarmEvent.get("SetpointA", "")  
eventValue = alarmEvent.get("eventValue", "")  
eventState = alarmEvent.get("eventState", "")

# Build localized email body

if locale == "zh":  
emailBody = u"""

### 标题: COE 报警通知
  

有一个报警已被触发，详情如下：

  

  
- **描述:** {displayPath}
  
- **事件时间:** {eventTime}
  
- **报警类型:** {priority}
  
- **设定值:** {setpoint}
  
- **事件值:** {eventValue}
  
- **状态变化:** {eventState}
  

  

请采取相应的措施。

  
[点击此处确认报警](http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack)  

此致敬礼，  
COE SCADA 系统

  
  
  
""".format(  
displayPath=displayPath,  
eventTime=eventTime,  
priority=priority,  
setpoint=setpoint,  
eventValue=eventValue,  
eventState=eventState  
)  
else:  
emailBody = """  
  
  

### Title: COE Alarm Notification
  

An alarm has been triggered. Please find the details below:

  

  
- **Description:** {displayPath}
  
- **Event Time:** {eventTime}
  
- **Alarm Type:** {priority}
  
- **Setpoint:** {setpoint}
  
- **Event Value:** {eventValue}
  
- **Status:** {eventState}
  

  

Please take action accordingly.

  
[Click here for Alarm Ack](http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack)  

Best Regards,  
COE SCADA System

  
  
  
""".format(  
displayPath=displayPath,  
eventTime=eventTime,  
priority=priority,  
setpoint=setpoint,  
eventValue=eventValue,  
eventState=eventState  
)

# Store the email body globally so the next block can use it

event.setGlobal("emailBody", emailBody)

> [@Marcus\_Sysum](#):
>
> in your script pipelineVars is local to this script so the email notification block does not have access to this. Try setting the email Body like this `event.setGlobal("emailBody", emailBody)` Then in your notification block you can reference the email body like above as `{emailBody}`

Can you please check the script I shared in the chat? When I added it again, I received a null message. Could you please assist me with this?

```
# Get locale (default to English)
locale = alarmEvent.get("locale", "en")

# Extract alarm values
displayPath = alarmEvent.get("displayPath", "")
eventTime = system.date.format(alarmEvent.get("eventTime"), "dd:MM:yyyy - HH:mm:ss")
priority = alarmEvent.get("priority", "")
setpoint = alarmEvent.get("SetpointA", "")
eventValue = alarmEvent.get("eventValue", "")
eventState = alarmEvent.get("eventState", "")

# Build localized email body
if locale == "zh":
	emailBody = u"""
	<html>
	    <body>
	        <h3>标题: COE 报警通知</h3>
	        <p>有一个报警已被触发，详情如下：</p>
	        <ul>
	            <li><strong>描述:</strong> {displayPath}</li>
	            <li><strong>事件时间:</strong> {eventTime}</li>
	            <li><strong>报警类型:</strong> {priority}</li>
	            <li><strong>设定值:</strong> {setpoint}</li>
	            <li><strong>事件值:</strong> {eventValue}</li>
	            <li><strong>状态变化:</strong> {eventState}</li>
	        </ul>
	        <p>请采取相应的措施。</p>
	        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">点击此处确认报警</a>
	        <p>此致敬礼，<br>COE SCADA 系统</p>
	    </body>
	</html>
	""".format(
	    displayPath=displayPath,
	    eventTime=eventTime,
	    priority=priority,
	    setpoint=setpoint,
	    eventValue=eventValue,
	    eventState=eventState
	)
else:
	emailBody = """
	<html>
	    <body>
	        <h3>Title: COE Alarm Notification</h3>
	        <p>An alarm has been triggered. Please find the details below:</p>
	        <ul>
	            <li><strong>Description:</strong> {displayPath}</li>
	            <li><strong>Event Time:</strong> {eventTime}</li>
	            <li><strong>Alarm Type:</strong> {priority}</li>
	            <li><strong>Setpoint:</strong> {setpoint}</li>
	            <li><strong>Event Value:</strong> {eventValue}</li>
	            <li><strong>Status:</strong> {eventState}</li>
	        </ul>
	        <p>Please take action accordingly.</p>
	        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">Click here for Alarm Ack</a>
	        <p>Best Regards,<br>COE SCADA System</p>
	    </body>
	</html>
	""".format(
	    displayPath=displayPath,
	    eventTime=eventTime,
	    priority=priority,
	    setpoint=setpoint,
	    eventValue=eventValue,
	    eventState=eventState
	)

# Store the email body globally so the next block can use it
event.setGlobal("emailBody", emailBody)

```

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 24, 2025, 8:37am UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/6 "2025-04-24T08:37:42Z")

</div>

> [@Transistor](#):
>
> Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831). Thanks.

Can you fix your most recent post as well?

---

<div class="post-metadata">

**Author:** ![abhijit.jagtap](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@abhijit.jagtap](https://forum.inductiveautomation.com/u/abhijit.jagtap)\
**Post date:** [April 24, 2025, 9:02am UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/7 "2025-04-24T09:02:26Z")

</div>

Below code working on script Console correctly but not working on alarm pipeline. I don't understand required any other setting.

alarmEvent = {  
"locale": "zh", # change to "zh" to test Chinese output  
"displayPath": "Tank Level High",  
"eventTime": system.date.now(),  
"priority": "High",  
"SetpointA": "85.0",  
"eventValue": "92.3",  
"eventState": "Active"  
}

# Function (paste your function here or import from project.alarm\_utils if saved)

def build\_email\_body(alarmEvent):  
locale = alarmEvent.get("locale", "en")  
displayPath = alarmEvent.get("displayPath", "")  
eventTime = system.date.format(alarmEvent.get("eventTime"), "dd:MM:yyyy - HH:mm:ss")  
priority = alarmEvent.get("priority", "")  
setpoint = alarmEvent.get("SetpointA", "")  
eventValue = alarmEvent.get("eventValue", "")  
eventState = alarmEvent.get("eventState", "")

```
if locale == "zh":
	emailBody = u"""
	<html>
	    <body>
	        <h3>标题: COE 报警通知</h3>
	        <p>有一个报警已被触发，详情如下：</p>
	        <ul>
	            <li><strong>描述:</strong> {displayPath}</li>
	            <li><strong>事件时间:</strong> {eventTime}</li>
	            <li><strong>报警类型:</strong> {priority}</li>
	            <li><strong>设定值:</strong> {setpoint}</li>
	            <li><strong>事件值:</strong> {eventValue}</li>
	            <li><strong>状态变化:</strong> {eventState}</li>
	        </ul>
	        <p>请采取相应的措施。</p>
	        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">点击此处确认报警</a>
	        <p>此致敬礼，<br>COE SCADA 系统</p>
	    </body>
	</html>
	""".format(
	    displayPath=displayPath,
	    eventTime=eventTime,
	    priority=priority,
	    setpoint=setpoint,
	    eventValue=eventValue,
	    eventState=eventState
	)
else:
	emailBody = """
	<html>
	    <body>
	        <h3>Title: COE Alarm Notification</h3>
	        <p>An alarm has been triggered. Please find the details below:</p>
	        <ul>
	            <li><strong>Description:</strong> {displayPath}</li>
	            <li><strong>Event Time:</strong> {eventTime}</li>
	            <li><strong>Alarm Type:</strong> {priority}</li>
	            <li><strong>Setpoint:</strong> {setpoint}</li>
	            <li><strong>Event Value:</strong> {eventValue}</li>
	            <li><strong>Status:</strong> {eventState}</li>
	        </ul>
	        <p>Please take action accordingly.</p>
	        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">Click here for Alarm Ack</a>
	        <p>Best Regards,<br>COE SCADA System</p>
	    </body>
	</html>
	""".format(
	    displayPath=displayPath,
	    eventTime=eventTime,
	    priority=priority,
	    setpoint=setpoint,
	    eventValue=eventValue,
	    eventState=eventState
	)

return emailBody

```

# Run the function and print the result

print build\_email\_body(alarmEvent)

---

<div class="post-metadata">

**Author:** ![abhijit.jagtap](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@abhijit.jagtap](https://forum.inductiveautomation.com/u/abhijit.jagtap)\
**Post date:** [April 24, 2025, 9:24am UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/8 "2025-04-24T09:24:59Z")

</div>

Please check this email to confirm if the code was sent correctly. The code was working as expected in the script console.

```python
# Simulate alarmEvent dictionary
alarmEvent = {
    "locale": "en", # change to "zh" to test Chinese output
    "displayPath": "Tank Level High",
    "eventTime": system.date.now(),
    "priority": "High",
    "SetpointA": "85.0",
    "eventValue": "92.3",
    "eventState": "Active"
}

# Function (paste your function here or import from project.alarm_utils if saved)
def build_email_body(alarmEvent):
	locale = alarmEvent.get("locale", "en")
	displayPath = alarmEvent.get("displayPath", "")
	eventTime = system.date.format(alarmEvent.get("eventTime"), "dd:MM:yyyy - HH:mm:ss")
	priority = alarmEvent.get("priority", "")
	setpoint = alarmEvent.get("SetpointA", "")
	eventValue = alarmEvent.get("eventValue", "")
	eventState = alarmEvent.get("eventState", "")

	if locale == "zh":
		emailBody = u"""
		<html>
		    <body>
		        <h3>标题: COE 报警通知</h3>
		        <p>有一个报警已被触发，详情如下：</p>
		        <ul>
		            <li><strong>描述:</strong> {displayPath}</li>
		            <li><strong>事件时间:</strong> {eventTime}</li>
		            <li><strong>报警类型:</strong> {priority}</li>
		            <li><strong>设定值:</strong> {setpoint}</li>
		            <li><strong>事件值:</strong> {eventValue}</li>
		            <li><strong>状态变化:</strong> {eventState}</li>
		        </ul>
		        <p>请采取相应的措施。</p>
		        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">点击此处确认报警</a>
		        <p>此致敬礼，<br>COE SCADA 系统</p>
		    </body>
		</html>
		""".format(
		    displayPath=displayPath,
		    eventTime=eventTime,
		    priority=priority,
		    setpoint=setpoint,
		    eventValue=eventValue,
		    eventState=eventState
		)
	else:
		emailBody = """
		<html>
		    <body>
		        <h3>Title: COE Alarm Notification</h3>
		        <p>An alarm has been triggered. Please find the details below:</p>
		        <ul>
		            <li><strong>Description:</strong> {displayPath}</li>
		            <li><strong>Event Time:</strong> {eventTime}</li>
		            <li><strong>Alarm Type:</strong> {priority}</li>
		            <li><strong>Setpoint:</strong> {setpoint}</li>
		            <li><strong>Event Value:</strong> {eventValue}</li>
		            <li><strong>Status:</strong> {eventState}</li>
		        </ul>
		        <p>Please take action accordingly.</p>
		        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">Click here for Alarm Ack</a>
		        <p>Best Regards,<br>COE SCADA System</p>
		    </body>
		</html>
		""".format(
		    displayPath=displayPath,
		    eventTime=eventTime,
		    priority=priority,
		    setpoint=setpoint,
		    eventValue=eventValue,
		    eventState=eventState
		)

	return emailBody

# Run the function and print the result
print build_email_body(alarmEvent)

```

I wrote this code in the Alarm Pipeline script section, but it was not working."

```python
# Get locale (default to English)
locale = alarmEvent.get("locale", "en")

# Extract alarm values
displayPath = alarmEvent.get("displayPath", "")
eventTime = system.date.format(alarmEvent.get("eventTime"), "dd:MM:yyyy - HH:mm:ss")
priority = alarmEvent.get("priority", "")
setpoint = alarmEvent.get("SetpointA", "")
eventValue = alarmEvent.get("eventValue", "")
eventState = alarmEvent.get("eventState", "")

# Build localized email body
if locale == "zh":
	emailBody = u"""
	<html>
	    <body>
	        <h3>标题: COE 报警通知</h3>
	        <p>有一个报警已被触发，详情如下：</p>
	        <ul>
	            <li><strong>描述:</strong> {displayPath}</li>
	            <li><strong>事件时间:</strong> {eventTime}</li>
	            <li><strong>报警类型:</strong> {priority}</li>
	            <li><strong>设定值:</strong> {setpoint}</li>
	            <li><strong>事件值:</strong> {eventValue}</li>
	            <li><strong>状态变化:</strong> {eventState}</li>
	        </ul>
	        <p>请采取相应的措施。</p>
	        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">点击此处确认报警</a>
	        <p>此致敬礼，<br>COE SCADA 系统</p>
	    </body>
	</html>
	""".format(
	    displayPath=displayPath,
	    eventTime=eventTime,
	    priority=priority,
	    setpoint=setpoint,
	    eventValue=eventValue,
	    eventState=eventState
	)
else:
	emailBody = """
	<html>
	    <body>
	        <h3>Title: COE Alarm Notification</h3>
	        <p>An alarm has been triggered. Please find the details below:</p>
	        <ul>
	            <li><strong>Description:</strong> {displayPath}</li>
	            <li><strong>Event Time:</strong> {eventTime}</li>
	            <li><strong>Alarm Type:</strong> {priority}</li>
	            <li><strong>Setpoint:</strong> {setpoint}</li>
	            <li><strong>Event Value:</strong> {eventValue}</li>
	            <li><strong>Status:</strong> {eventState}</li>
	        </ul>
	        <p>Please take action accordingly.</p>
	        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">Click here for Alarm Ack</a>
	        <p>Best Regards,<br>COE SCADA System</p>
	    </body>
	</html>
	""".format(
	    displayPath=displayPath,
	    eventTime=eventTime,
	    priority=priority,
	    setpoint=setpoint,
	    eventValue=eventValue,
	    eventState=eventState
	)

# Store the email body globally so the next block can use it
event.setGlobal("emailBody", emailBody)

```

and finally pass notification massage below code.

`{emailBody}`

now this better i think for understanding.

---

<div class="post-metadata">

**Author:** ![Marcus\_Sysum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/marcus_sysum/32/57944_2.png) [@Marcus\_Sysum](https://forum.inductiveautomation.com/u/Marcus_Sysum)\
**Post date:** [April 24, 2025, 2:09pm UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/9 "2025-04-24T14:09:12Z")

</div>

Have you checked the gateway logs for errors? I did a simple test with this code and there are many errors. Which is why the **whole notification returns null**.  
Are you running this inside the actual script block in the pipeline?  
Like this.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/9/199f6a2ab6733813efe80397b060f540df67bfca.png)

In your script you have **alarmEvent.get()** which is not valid its **event.get()** with only one argument. When using it in the pipeline scripting block

Locale is not valid parameter in the event object unless you are passing it in somewhere else. I am not sure the full context of this script.  
Here below is what I tested

```python
def handleAlarm(event):
	logger = system.util.getLogger("pipeline")
	# Get locale (default to English)
	locale = event.get("locale")
	logger.infof("locale: %s", locale)
	# Extract alarm values
	displayPath = event.get("displayPath")
	eventTime = system.date.format(event.get("eventTime"), "dd:MM:yyyy - HH:mm:ss")
	priority = event.get("priority")
	setpoint = event.get("SetpointA")
	eventValue = event.get("eventValue")
	eventState = event.get("eventState")
	
	# Build localized email body
	if locale == "zh":
		emailBody = u"""
		<html>
		    <body>
		        <h3>标题: COE 报警通知</h3>
		        <p>有一个报警已被触发，详情如下：</p>
		        <ul>
		            <li><strong>描述:</strong> {displayPath}</li>
		            <li><strong>事件时间:</strong> {eventTime}</li>
		            <li><strong>报警类型:</strong> {priority}</li>
		            <li><strong>设定值:</strong> {setpoint}</li>
		            <li><strong>事件值:</strong> {eventValue}</li>
		            <li><strong>状态变化:</strong> {eventState}</li>
		        </ul>
		        <p>请采取相应的措施。</p>
		        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">点击此处确认报警</a>
		        <p>此致敬礼，<br>COE SCADA 系统</p>
		    </body>
		</html>
		""".format(
		    displayPath=displayPath,
		    eventTime=eventTime,
		    priority=priority,
		    setpoint=setpoint,
		    eventValue=eventValue,
		    eventState=eventState
		)
	else:
		emailBody = """
		<html>
		    <body>
		        <h3>Title: COE Alarm Notification</h3>
		        <p>An alarm has been triggered. Please find the details below:</p>
		        <ul>
		            <li><strong>Description:</strong> {displayPath}</li>
		            <li><strong>Event Time:</strong> {eventTime}</li>
		            <li><strong>Alarm Type:</strong> {priority}</li>
		            <li><strong>Setpoint:</strong> {setpoint}</li>
		            <li><strong>Event Value:</strong> {eventValue}</li>
		            <li><strong>Status:</strong> {eventState}</li>
		        </ul>
		        <p>Please take action accordingly.</p>
		        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">Click here for Alarm Ack</a>
		        <p>Best Regards,<br>COE SCADA System</p>
		    </body>
		</html>
		""".format(
		    displayPath=displayPath,
		    eventTime=eventTime,
		    priority=priority,
		    setpoint=setpoint,
		    eventValue=eventValue,
		    eventState=eventState
		)
	logger.info(emailBody)
	# Store the email body globally so the next block can use it
	event.setGlobal("emailBody", emailBody)	

```

This Code generates the html and passes it correctly but locale is always null as it doesn't exist.  
Check your gateway logs for errors. If you want to chek if something exists in the event object you can use the `event.contains()` method. `event.contains('locale')` returns false. In my case because it is never exists.

---

<div class="post-metadata">

**Author:** ![abhijit.jagtap](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@abhijit.jagtap](https://forum.inductiveautomation.com/u/abhijit.jagtap)\
**Post date:** [April 25, 2025, 7:06am UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/10 "2025-04-25T07:06:38Z")

</div>

Hello,  
instead of locale I passed label in below script and bind tag to there. but I received massage in English only.  
I'm not sure if I'm on the right track with the translation—we're doing this for the first time in the alarm pipeline notification.  
Could you please provide the proper solution with an example?

My main concern is how to translate the outgoing alarm message according to the selected language.  
If possible, could we arrange a Teams meeting at a time that works best for you? Please let me know when we can connect to find the perfect solution.

```python
	logger = system.util.getLogger("pipeline")
#	
# # Get label for translation (default to English)
	label = event.get("label")
	logger.infof("label: %s", label)		

	# Extract alarm values
	
	displayPath = event.get("displayPath")
	eventTime = system.date.format(event.get("eventTime"), "dd:MM:yyyy - HH:mm:ss")
	priority = event.get("priority")
	setpoint = event.get("SetpointA")
	eventValue = event.get("eventValue")
	eventState = event.get("eventState")

	# Build localized email body based on label
	if label == "zh":
		emailBody = u"""
		<html>
		    <body>
		        <h3>标题: COE 报警通知</h3>
		        <p>有一个报警已被触发，详情如下：</p>
		        <ul>
		            <li><strong>描述:</strong> {displayPath}</li>
		            <li><strong>事件时间:</strong> {eventTime}</li>
		            <li><strong>报警类型:</strong> {priority}</li>
		            <li><strong>设定值:</strong> {setpoint}</li>
		            <li><strong>事件值:</strong> {eventValue}</li>
		            <li><strong>状态变化:</strong> {eventState}</li>
		        </ul>
		        <p>请采取相应的措施。</p>
		        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">点击此处确认报警</a>
		        <p>此致敬礼，<br>COE SCADA 系统</p>
		    </body>
		</html>
		""".format(
		    displayPath=displayPath,
		    eventTime=eventTime,
		    priority=priority,
		    setpoint=setpoint,
		    eventValue=eventValue,
		    eventState=eventState
		)
	else:
		emailBody = """
		<html>
		    <body>
		        <h3>Title: COE Alarm Notification</h3>
		        <p>An alarm has been triggered. Please find the details below:</p>
		        <ul>
		            <li><strong>Description:</strong> {displayPath}</li>
		            <li><strong>Event Time:</strong> {eventTime}</li>
		            <li><strong>Alarm Type:</strong> {priority}</li>
		            <li><strong>Setpoint:</strong> {setpoint}</li>
		            <li><strong>Event Value:</strong> {eventValue}</li>
		            <li><strong>Status:</strong> {eventState}</li>
		        </ul>
		        <p>Please take action accordingly.</p>
		        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">Click here for Alarm Ack</a>
		        <p>Best Regards,<br>COE SCADA System</p>
		    </body>
		</html>
		""".format(
		    displayPath=displayPath,
		    eventTime=eventTime,
		    priority=priority,
		    setpoint=setpoint,
		    eventValue=eventValue,
		    eventState=eventState
		)

	logger.info(emailBody)
	# Store the email body globally so the next block can use it
	event.setGlobal("emailBody", emailBody)

```

---

<div class="post-metadata">

**Author:** ![Marcus\_Sysum](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/marcus_sysum/32/57944_2.png) [@Marcus\_Sysum](https://forum.inductiveautomation.com/u/Marcus_Sysum)\
**Post date:** [April 25, 2025, 1:27pm UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/11 "2025-04-25T13:27:58Z")

</div>

If your force label to equal zh in the script you will see the alternate language. I had done this in my test. The loggers in place should show you what is being passed into the label. If you you still need assistance then please reach out to support.  
[https://support.inductiveautomation.com/hc/en-us](https://support.inductiveautomation.com/hc/en-us)

---

<div class="post-metadata">

**Author:** ![abhijit.jagtap](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@abhijit.jagtap](https://forum.inductiveautomation.com/u/abhijit.jagtap)\
**Post date:** [April 25, 2025, 2:03pm UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/12 "2025-04-25T14:03:25Z")

</div>

![mail](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/a/fac0f2181ba0fa66280db831e20f6c04e5ef3c3f.png)  
Hello.  
Know I have tried with below code as per you said tried with label = "zh"  
then I have received attached mail format.  
can you have any demo for entire email translation. If you have, please send me.

I am available now if get small session.

```python
def handleAlarm(event):
	logger = system.util.getLogger("pipeline")
	#	
# # Get label for translation (default to English)
	label = "zh"
	logger.infof("label: %s", label)		

	# Extract alarm values
	
	displayPath = event.get("displayPath")
	eventTime = system.date.format(event.get("eventTime"), "dd:MM:yyyy - HH:mm:ss")
	priority = event.get("priority")
	setpoint = event.get("SetpointA")
	eventValue = event.get("eventValue")
	eventState = event.get("eventState")

	# Build localized email body based on label
	if label == "zh":
		emailBody = u"""
		<html>
		    <body>
		        <h3>标题: COE 报警通知</h3>
		        <p>有一个报警已被触发，详情如下：</p>
		        <ul>
		            <li><strong>描述:</strong> {displayPath}</li>
		            <li><strong>事件时间:</strong> {eventTime}</li>
		            <li><strong>报警类型:</strong> {priority}</li>
		            <li><strong>设定值:</strong> {setpoint}</li>
		            <li><strong>事件值:</strong> {eventValue}</li>
		            <li><strong>状态变化:</strong> {eventState}</li>
		        </ul>
		        <p>请采取相应的措施。</p>
		        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">点击此处确认报警</a>
		        <p>此致敬礼，<br>COE SCADA 系统</p>
		    </body>
		</html>
		""".format(
		    displayPath=displayPath,
		    eventTime=eventTime,
		    priority=priority,
		    setpoint=setpoint,
		    eventValue=eventValue,
		    eventState=eventState
		)
	else:
		emailBody = """
		<html>
		    <body>
		        <h3>Title: COE Alarm Notification</h3>
		        <p>An alarm has been triggered. Please find the details below:</p>
		        <ul>
		            <li><strong>Description:</strong> {displayPath}</li>
		            <li><strong>Event Time:</strong> {eventTime}</li>
		            <li><strong>Alarm Type:</strong> {priority}</li>
		            <li><strong>Setpoint:</strong> {setpoint}</li>
		            <li><strong>Event Value:</strong> {eventValue}</li>
		            <li><strong>Status:</strong> {eventState}</li>
		        </ul>
		        <p>Please take action accordingly.</p>
		        <a href="http://172.16.8.250:8088/data/perspective/client/Ignition_COE_Dev/AlarmPipelineack">Click here for Alarm Ack</a>
		        <p>Best Regards,<br>COE SCADA System</p>
		    </body>
		</html>
		""".format(
		    displayPath=displayPath,
		    eventTime=eventTime,
		    priority=priority,
		    setpoint=setpoint,
		    eventValue=eventValue,
		    eventState=eventState
		)

	logger.info(emailBody)
	# Store the email body globally so the next block can use it
	event.setGlobal("emailBody", emailBody)

```

---

<div class="post-metadata">

**Author:** ![abhijit.jagtap](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@abhijit.jagtap](https://forum.inductiveautomation.com/u/abhijit.jagtap)\
**Post date:** [April 25, 2025, 2:14pm UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/13 "2025-04-25T14:14:33Z")

</div>

Hi,

I have done some R&D and created two email profiles. If the selected language is "zh", profile 1 sends the email, and if "en" is selected, profile 2 sends the email.

However, in this case, the description of alarm, alarm type, and transitioned state are not translated into Chinese, although all the other data is correctly translated.

I did not use any script block in this case.  
I have attached a snapshot for your reference.

 ![mail1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/0/90aefd590aec1a69a547bcef80c6d31f5fd4c70f.png)  
 ![mail2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/1/a1d837e00399cfaa48b9cd1ac4940864f58d0a38.png)

---

<div class="post-metadata">

**Author:** ![abhijit.jagtap](https://avatars.discourse-cdn.com/v4/letter/a/3bc359/32.png) [@abhijit.jagtap](https://forum.inductiveautomation.com/u/abhijit.jagtap)\
**Post date:** [April 30, 2025, 5:16am UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/14 "2025-04-30T05:16:07Z")

</div>

Hi,  
Could you please let me know if it’s possible to translate this? It’s an urgent requirement from the customer side. If possible, we can connect for better understanding.

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [April 30, 2025, 7:54am UTC](https://forum.inductiveautomation.com/t/change-the-email-language-in-the-email-pipeline-from-english-to-chinese-based-on-the-selected-language/105418/15 "2025-04-30T07:54:51Z")

</div>

You need to contact [Support](https://support.inductiveautomation.com). This forum is not an official support venue. Most of us are volunteers.
