# Removing global translations with scripting?

**URL:** <https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755>\
**Category:** Ignition\
**Created:** [August 15, 2020, 5:21am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755 "2020-08-15T05:21:21Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [August 15, 2020, 5:21am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/1 "2020-08-15T05:21:21Z")

</div>

I know about **system.util.modifyTranslation** for adding or modifying global translations.  
But what about removing translation (key) with scripting? Is this possible?  
I didn’t find any reference for deleting single one or more keys from global translations anywhere in the documentation or on the forum…?  
Oh, I’m on Ignition v7.9.14.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [August 16, 2020, 7:16am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/2 "2020-08-16T07:16:53Z")

</div>

I found [this: MutableTranslationPackage (removeKey)](http://files.inductiveautomation.com/sdk/javadoc/ignition79/794-beta1/com/inductiveautomation/ignition/common/i18n/translation/BasicTranslationPackage.html#removeKey-java.lang.String-), so it’s possible to remove translations (keys).  
But I really don’t know how to use this in a script.  
Can someone provide an example, please…? 🙏  
@paul-griffith or @KathyApplebaum maybe… [this](http://forum.inductiveautomation.com/t/feature-14961-add-system-util-modifytranslation-to-gw-perspective/28157/2) doesn’t work in v7.9.14…?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [August 16, 2020, 9:10pm UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/3 "2020-08-16T21:10:31Z")

</div>

~~`from com.inductiveautomation.ignition.gateway import IgnitionGateway`  
 `IgnitionGateway.get().getLocalizationManager().removeTerm("string")`  
Should do it~~

This is wrong; see below for an updated example.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [August 16, 2020, 9:51pm UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/4 "2020-08-16T21:51:38Z")

</div>

> [@paul-griffith](#):
>
> from com.inductiveautomation.ignition.gateway import IgnitionGateway

Yes, I tried that, but the thing is, that when I'm doing:

```auto
from com.inductiveautomation.ignition.gateway import IgnitionGateway

```

I get an error:

 ![Screenshot_1](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/8/6874340355e3dd279b5d12e4eba1e0038bdef3c3.png)

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 16, 2020, 9:58pm UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/5 "2020-08-16T21:58:34Z")

</div>

IgnitionGateway, GatewayContext, and the TranslationManager are only accessible in the gateway scope. You won’t be able to run this in an event like that without sending a message to the gateway to have it execute there.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [August 17, 2020, 5:36am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/6 "2020-08-17T05:36:31Z")

</div>

> [@paul-griffith](#):
>
> from com.inductiveautomation.ignition.gateway import IgnitionGateway IgnitionGateway.get().getLocalizationManager().removeTerm("string")

OK, I tried that with MessageHandler, still getting error:

 ![Cannot_import_name_IgnitionGateway](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/8/0836860f8082d73c864f3267b86ae2c191747b1e.png)  
 ![TranslationDeleteTerm_scripts](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/1/6145fe13c2fc75cc5ca399196f89e20dea045417.png)

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [August 17, 2020, 6:14am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/7 "2020-08-17T06:14:11Z")

</div>

I found out that IgnitionGateway is on V8.0.  
I’m using v7.9.14(13) and I need to use SRContext.  
Then I get no error but the term is also not deleted despite that log says otherwise:

 ![TranslationDeleteTerm_scripts2](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/e/deffb21e025a2461deb34886688eb0af1686f8bc.png)  
When I open Translation Manager in designer, the ‘deleted’ term (key) is still there with all translations.  
Even closing the designer and opening again (to refresh translations\_e1\_v1.dat in .ignition\cache folder… in Windows) doesn’t help.

---

<div class="post-metadata">

**Author:** ![zxcslo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/zxcslo/32/61610_2.png) [@zxcslo](https://forum.inductiveautomation.com/u/zxcslo)\
**Post date:** [August 17, 2020, 8:05am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/8 "2020-08-17T08:05:54Z")

</div>

OK, what I ended up using is this:

 ![TranslationDeleteTerm_script3](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/2/a2dba62be23753ab9ab553e9f3c66d78056c6812.png)  
and is working as it should. 🙂  
I’m calling this from my button actionPerformed event:  
 ![TranslationDeleteTerm_script4](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/9/698df532079eaea1f439abcdf02cebcafc8553ed.png)

---

<div class="post-metadata">

**Author:** ![Rohit\_Das](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@Rohit\_Das](https://forum.inductiveautomation.com/u/Rohit_Das)\
**Post date:** [July 10, 2023, 8:51am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/9 "2023-07-10T08:51:28Z")

</div>

I have question not related to the topic  
From the screenshot above, it seems that you have a table with all the translation terms in translation manager from which you can select one and delete. How did you populate all those terms in a table?

---

<div class="post-metadata">

**Author:** ![justinedwards.jle](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justinedwards.jle/32/37854_2.png) [@justinedwards.jle](https://forum.inductiveautomation.com/u/justinedwards.jle)\
**Post date:** [July 10, 2023, 9:25am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/10 "2023-07-10T09:25:41Z")

</div>

> [@Rohit\_Das](#):
>
> you have a table with all the translation terms in translation manager from which you can select one and delete

What I see depicted in the image is the Translation Manager. It is accessible in the designer from the "Tools" dropdown.  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/0/40893a40aaa33b9a93177f2f9e57ccd95dca8c50.png)

---

<div class="post-metadata">

**Author:** ![Rohit\_Das](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@Rohit\_Das](https://forum.inductiveautomation.com/u/Rohit_Das)\
**Post date:** [July 10, 2023, 10:28am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/11 "2023-07-10T10:28:19Z")

</div>

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/3/d3177a11484037d59c461f1386851f19ac97ff9e.png)

In this screenshot he shared, highlighted portion is showing he's getting the term from a table in UI.  
I just want to know how to get those terms in a table, so that the operator can select the term to delete

---

<div class="post-metadata">

**Author:** ![m.pelagatti](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/m.pelagatti/32/68595_2.png) [@m.pelagatti](https://forum.inductiveautomation.com/u/m.pelagatti)\
**Post date:** [March 27, 2024, 9:12am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/12 "2024-03-27T09:12:48Z")

</div>

Ignition 8.1.36 , Windows 10

Hi ,  
I'm trying to remove a translation via script, I created a messageHandler like this:

 ![2024-03-27 10_01_38-Gateway Event Scripts](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/7/e7f6d4988854d67d0a76ca33d7a5ad138cc973a7.png)

I call the message from script console with system.util.sendMessage, I have no error.

`[type=Gateway,project=Diss_standard,messageHandler=translationDeleteKey,filterParams={userZones=, userRoles=Administrator, x_protectResource},isRequest=no,sendStatus=SENT]`

The gateway log tells me "Removig term 'aaaa'":

 ![2024-03-27 10_00_36-ignition-adueserver - Ignition Gateway](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/5/a53f5366c98c50fe49249c79c9759731a16d391e.png)

But the key in the translation manager was not removed  
Is there an instruction to commit the changes? Has anyone had the same problem?

Thank you

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 27, 2024, 6:49pm UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/13 "2024-03-27T18:49:18Z")

</div>

Look at @zxcslo's updated example above:

> [@Removing global translations with scripting?](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/8):
>
> OK, what I ended up using is this: and is working as it should. slightly_smiling_face I’m calling this from my button actionPerformed event:

My original post was just wrong; this is the correct approach.

---

<div class="post-metadata">

**Author:** ![m.pelagatti](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/m.pelagatti/32/68595_2.png) [@m.pelagatti](https://forum.inductiveautomation.com/u/m.pelagatti)\
**Post date:** [March 28, 2024, 9:49am UTC](https://forum.inductiveautomation.com/t/removing-global-translations-with-scripting/37755/14 "2024-03-28T09:49:05Z")

</div>

Hi,  
the problem was SRContext was changed in IgnitionGateway

Final solution:

 ![2024-03-28 10_46_43-Window](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/b/cb75c9059a4df67a9117206dae2d83c355554e04.png)

code:

```auto
def handleMessage(payload):
	from com.inductiveautomation.ignition.gateway import IgnitionGateway
	from com.inductiveautomation.ignition.common.i18n.translation import TranslationPackageDiff
	
	key = payload["key"]
	
	modification = TranslationPackageDiff()
	modification.removeKey(key)
	IgnitionGateway.get().getLocalizationManager().applyDiff(modification)

```

Thanks  
Bye
