# Google Translate breaking client-side text

**URL:** <https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 30, 2024, 1:13pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605 "2024-09-30T13:13:45Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Henrique\_Starosky](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrique_starosky/32/81725_2.png) [@Henrique\_Starosky](https://forum.inductiveautomation.com/u/Henrique_Starosky)\
**Post date:** [September 30, 2024, 1:13pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/1 "2024-09-30T13:13:45Z")

</div>

Hello! Hope you're all doing well!  
I'm having a _very annoying_ time with Google Translate on our clients. Summarizing our issue, all our projects are in Brazilian Portuguese, but even when defining the locale of the project to `pt-BR` the Google Translate popup shows up.  
[Here](https://stackoverflow.com/questions/12238396/how-to-disable-google-translate-from-html-in-chrome) they mention using some parameters on the HTML tags for a webpage, but as we can't control Perspective's \<head\> content, that won't be possible.

---

<div class="post-metadata">

**Author:** ![Henrique\_Starosky](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrique_starosky/32/81725_2.png) [@Henrique\_Starosky](https://forum.inductiveautomation.com/u/Henrique_Starosky)\
**Post date:** [September 30, 2024, 1:18pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/2 "2024-09-30T13:18:55Z")

</div>

Here are a few examples of how Google Translate breaks stuff in our projects:

 ![reservatorios-bug](https://us1.discourse-cdn.com/inductiveautomation/original/3X/0/c/0c1c35efd6a8fdf2b875b952f9e887335fae5d3a.png)  
In this image, all the names should be Res. (as in _Reservatório_/Water Tank).

![etas-bug](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/5/b5aac9c65b0e3fb7c078cb65ee47dcc038dd59ae.png)  
In this image, `ETA eu` should be `ETA I`, or `ETA 1` written using an uppercase `i`.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [September 30, 2024, 1:58pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/3 "2024-09-30T13:58:54Z")

</div>

My suggestion would be that if you're using these on dedicated computers for operations that you use the Perspective Workstation app instead of your browser. If these are just client computers, then suggest another browser, or see if there's a way to disable Google translate on individual domains.

---

<div class="post-metadata">

**Author:** ![Henrique\_Starosky](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrique_starosky/32/81725_2.png) [@Henrique\_Starosky](https://forum.inductiveautomation.com/u/Henrique_Starosky)\
**Post date:** [September 30, 2024, 5:27pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/4 "2024-09-30T17:27:51Z")

</div>

While that would fix the issue at hand, that shouldn't be seen as a proper solution that problem.  
I'll send this issue to the support as a QoL improvement for the platform. Hopefully we can kill tickets coming due to this.

---

<div class="post-metadata">

**Author:** ![flexware](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/flexware/32/66243_2.png) [@flexware](https://forum.inductiveautomation.com/u/flexware)\
**Post date:** [September 30, 2024, 6:05pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/5 "2024-09-30T18:05:29Z")

</div>

From a purely stylistic point of view (meaning nothing to do with the actual text that's being translated), you could also improve your component a little bit in the following ways (if you so choose):

1. Add the CSS ellipsis feature to your Tank component so that if you have a longer title, it gets truncated. So, `"Resposta ETA I"` turns into `"Resposta..."` and then for added benefit, you can turn the tooltip on for the Label component and display the full label text on hover. OR you can also just make the Tank component/card larger to fit text. I like the ellipsis approach as it future-proofs your design (even if you make the component bigger, you might still get a tank that exceeds the tank size). Here is some code to get you started with that:

```css
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden

```

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/5/9/59417b495fdf70683a0ad0d8927543dfa1e6b0a1.png)

1. You can force the Valve component to always cast the Label to upper-case using `text-transform: uppercase`. That way, even if you get the wrong text in there, at least you'll get all-capped wrong text 😉

---

<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:** [September 30, 2024, 6:06pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/6 "2024-09-30T18:06:02Z")

</div>

> [@Henrique\_Starosky](#):
>
> we can't control Perspective's `<head>` content

Not _quite_ true...

> [@Perspective HTML Injection](https://forum.inductiveautomation.com/t/perspective-html-injection/74680):
>
> So... while doing some module debugging, I noticed Ignition trying to access a non-existent folder \<install-directory\>\data\modules\com.inductiveautomation.perspective\injectables. After creating the folder manually, Ignition then tried to access: injectables\head\_top.txt injectables\head\_bottom.txt injectables\body\_top.txt injectables\body\_bottom.txt And what do you know, any HTML you put in these files will be directly loaded in the DOM of all Perspective sessions man_shrugging . [java\_x…

Note the disclaimers about this technique in my post below.

---

<div class="post-metadata">

**Author:** ![Henrique\_Starosky](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrique_starosky/32/81725_2.png) [@Henrique\_Starosky](https://forum.inductiveautomation.com/u/Henrique_Starosky)\
**Post date:** [September 30, 2024, 6:34pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/7 "2024-09-30T18:34:28Z")

</div>

I'll send this our designers here. At least we won't have overflows breaking the visuals. Thanks!

---

<div class="post-metadata">

**Author:** ![Henrique\_Starosky](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrique_starosky/32/81725_2.png) [@Henrique\_Starosky](https://forum.inductiveautomation.com/u/Henrique_Starosky)\
**Post date:** [September 30, 2024, 6:40pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/8 "2024-09-30T18:40:36Z")

</div>

Okay, okay... There is a way hehehe.  
Writing a simple `<meta name="google" content="notranslate">` to the `injectables\head_bottom.txt` shouldn't break anything, but I don't really like that idea... Perhaps there is another way that could be implemented.  
Correct me if I'm wrong, but Perspective is based on React/Next, yes?

---

<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:** [September 30, 2024, 6:53pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/9 "2024-09-30T18:53:41Z")

</div>

React, yes. As far as I know we don't use NextJS.

---

<div class="post-metadata">

**Author:** ![Henrique\_Starosky](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/henrique_starosky/32/81725_2.png) [@Henrique\_Starosky](https://forum.inductiveautomation.com/u/Henrique_Starosky)\
**Post date:** [September 30, 2024, 6:57pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/10 "2024-09-30T18:57:37Z")

</div>

I see. It should be possible then to write a Perspective module that uses hooks or other solutions to manipulate the DOM in a manner that would apply the fixes mentioned in the post I linked on the OP. I'll see to it whenever I'm done with my current assignment here.

---

<div class="post-metadata">

**Author:** ![michael.flagler](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/michael.flagler/32/26272_2.png) [@michael.flagler](https://forum.inductiveautomation.com/u/michael.flagler)\
**Post date:** [September 30, 2024, 9:45pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/11 "2024-09-30T21:45:53Z")

</div>

From a security standpoint, is there any worry that code could be injected by some threat actor into these files without the owner/end-user knowing about it? Or is the general assumption that if they get direct file access to the server, all bets are off anyway since the OS has been compromised?

Edit: I guess really at that point any file on the OS could be modified, even in other parts of the Ignition configuration.

---

<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:** [September 30, 2024, 10:26pm UTC](https://forum.inductiveautomation.com/t/google-translate-breaking-client-side-text/96605/12 "2024-09-30T22:26:53Z")

</div>

Exactly that. If you can write to those files, the game's already over - you could just as easily write to the jar files that make up Ignition itself and transparently overwrite the application to do something malicious.
