[feature-14961]Add system.util.modifyTranslation to GW/Perspective

Dears,
I notice the system.util.modifyTranslation is not available from perspective side (8.0.3 release).
At this time is there a way to dinamically modify a translation term from the client interface?
If not, when it will be added?

Thank you,
Andrea

It’s not ideal, but this code should work for now (only from the Gateway/Perspective):

from org.apache.commons.lang3 import LocaleUtils

from com.inductiveautomation.ignition.gateway import IgnitionGateway
from com.inductiveautomation.ignition.common.i18n.translation import TranslationPackageDiff

translationLocale = LocaleUtils.toLocale("en_US")

modifications = TranslationPackageDiff()

modifications.addTranslation("term", translationLocale, "translation")

IgnitionGateway.get().getLocalizationManager().applyDiff(modifications)

Thank you. it works!
What about the temporary workaround for the system.util.translate function?

Best,
Andrea

from com.inductiveautomation.ignition.gateway import IgnitionGateway
translations = IgnitionGateway.get().getLocalizationManager().loadFullPackage()

translation = translations.get(<locale>, "term")

translations will be an instance of a TranslationPackage.

Ok, thanks!

Dear Paul,
after the term translation, should I force a refresh for the TranslationPackage?
I see the right translations from the Translation Manager inside the Designer, but not in the Perspective client.
Where am I wrong?

Thanks,
Andrea

I need to translate some term from a module in the gateway scope only.
I don't find how to access to the right manager for translation ? from the gatewayContext ?

The localization manager class isn't in the public SDK, for some reason. So you'll have to use reflection.

1 Like

What is the package of LocalizationManager class to access it with reflection ?

com.inductiveautomation.ignition.gateway.i18n.LocalizationManagerImpl

1 Like

Is there any reason you can just supply a localization bundle in your GatewayHook?