ArticleTranslation quality

What LangRelay's script does on your website, and how to check it

What the LangRelay script does and never does on your pages, how it is served, and the checks you can run yourself in your browser in a few minutes.

Published
Reading time
6 min read
Two cloth traders shake hands across a stall of patterned bolts in a sunlit mud-brick market square, a carved doorway framed in green and orange leaf tiles behind them and a solar water tower beside the square.
On this page
  1. What the script is for
  2. What it never does
  3. How the script reaches your visitors
  4. Checks you can run yourself
  5. Watch what it sends
  6. Check that pinning works
  7. Check privacy signals
  8. Using LangRelay with a Content Security Policy
  9. In short

Adding a script from another company to your website is a decision about trust. The script runs inside your pages, next to your forms, your checkout and your visitors. You should know what it does there, where it comes from, and how to check both without taking anyone's word for it.

This is that account for LangRelay's script: what it does on your pages, what it never does, how it reaches your visitors, and the checks you can run yourself in a few minutes.

What the script is for#

LangRelay translates your site and keeps it translated as it changes. Most of that happens away from your visitors. The script is the small part that runs in their browser, and it has three jobs:

  • Show approved translations. When a visitor reads your site in another language, the script swaps the original text for the translation you have approved and that is live. Text that has no live translation stays in the original language.
  • Draw the language switcher. It puts the switcher on the page, in the style you chose, and changes language when the visitor picks one.
  • Suggest the visitor's language, if you turned that on. On the first page of a visit, when the page is live in a language the browser prefers, the visitor is offered it. Nothing moves without a click unless you chose a redirect.

When Visitor analytics is on, it also counts a page view, which is described further down.

What it never does#

These are the limits that matter most when a script sits on your pages.

It never sends your page's text to LangRelay. The script downloads the translations for the language being shown and matches them in the visitor's browser. The words on your page, what visitors type into forms and the content of your checkout stay where they are.

It never sends cookies or the page's full address with its requests. Every request it makes to LangRelay leaves the visitor's cookies behind and carries no referrer, so LangRelay cannot tie a request to a signed-in account or see a query string. The page-view count is the one request that names a page, and it names only its path.

It writes translations as plain text. A translation can change the words on a page and nothing else. It cannot add a link, a script, a form field or any other markup, so a translation cannot be used to inject code into your site.

It runs no code from anywhere else. It loads only its own files, from the same place it came from: the language suggestion when it is about to show one, and the switcher's images. It never evaluates text as code, so it works on sites that forbid that.

It cannot spend your words or change your Site. Anyone can open the addresses the script reads, so they only ever return what is already public on your site: approved, live translations and the switcher's settings. Nothing a visitor's browser sends can start a translation, use your monthly words or change anything in your account.

It sets no tracking cookie. The only thing it remembers in a visitor's browser is their language choice, on your own site and only after they make one: the language they picked, or that they would rather stay in the one they are reading.

How the script reaches your visitors#

On WordPress, the plugin carries its own copy of the script. It is served from your own site, alongside the plugin's other files, and it talks to LangRelay only to read your translations and switcher settings, and to count a page view when Visitor analytics is on.

On any other site, you add one script tag, which you copy from your Site's settings under Script embed. The script comes from api.langrelay.com, and every release has its own address with the version number in it. Once a version is released, its file never changes: a fix or a new feature is always a new version at a new address.

Script embed offers two tags:

  • The pinned tag (recommended) names one version and carries its fingerprint in an integrity attribute. Your visitors' browsers compare the file they receive with that fingerprint and refuse to run it if a single byte differs. The pinned script checks the one other script file it may load, the language suggestion, against a fingerprint of its own, so everything that runs on your page is covered. To move to a newer version, copy the tag again.
  • The always-current tag points to the latest version, so you get updates without touching your site. Because its content changes with each release, it cannot carry a fingerprint.

Your visitors' browsers keep a pinned version for a year, so a returning visitor does not download it again.

Checks you can run yourself#

You do not need to trust any of the above. Each part can be seen in your own browser.

Watch what it sends#

Open a translated page, open your browser's developer tools and go to the Network tab. Filter by langrelay. On a site using the script tag you will see:

  • the script itself (on WordPress, it comes from your own site instead);
  • one small read of your Site's public settings;
  • the translations for the language on screen, when that language is not your original;
  • the switcher's images (flags, and LangRelay's logo where it shows);
  • one page-view request, when Visitor analytics is on.

Click any request to LangRelay and look at its request headers. There is no Cookie header and no Referer header. The page-view request's body shows everything it sends: the page's path, the language, and the name of the site the visitor came from, if any.

Check that pinning works#

On a test page, change one character of the integrity value in the pinned tag and reload. The browser refuses the script, says so in the Console, and no switcher appears. Put the value back and it returns. That is the same refusal a visitor's browser would make if the file were ever changed.

Check privacy signals#

Turn on Global Privacy Control in your browser (some browsers have it built in; others need an extension) and reload a page. The page-view request does not appear. The same happens with the older Do Not Track setting. The rest of the script keeps working: translations and the switcher do not depend on counting.

Using LangRelay with a Content Security Policy#

A Content Security Policy tells browsers which sources a page may load from, and many security-minded sites send one. LangRelay's script tag works with a strict policy. A page that uses it needs these sources:

Directive

Allow

script-src

https://api.langrelay.com, or your page's nonce on the script tag

connect-src

https://api.langrelay.com

img-src

https://api.langrelay.com and data: (the switcher's small arrow and check mark)

style-src

your page's nonce on the script tag, or 'unsafe-inline'

If your site gives its scripts a nonce, put the same nonce attribute on LangRelay's script tag. The script hands that nonce to the styles and the one script file it adds, so you do not need 'unsafe-inline' for either. It never needs 'unsafe-eval'.

If your policy requires Trusted Types (require-trusted-types-for 'script') and lists the policies your site may create in trusted-types, add langrelay to that list. The script creates one policy by that name, only to load its language suggestion file, and the policy accepts nothing but that file's address. Without the name, translations and the switcher work as before and only the language suggestion is left out. LangRelay never edits that list for you.

On WordPress the script and its images come from your own site, together with a short inline script the plugin prints in the page, which your policy must also allow. Allow https://api.langrelay.com in connect-src so the script can read your translations, data: in img-src, and for now 'unsafe-inline' in style-src for the switcher's styles. A policy that requires Trusted Types (require-trusted-types-for) is not supported on WordPress yet, so keep that directive in report-only mode there.

In short#

The script shows the translations you approved, draws your switcher and, if you ask it to, suggests a visitor's language. It does not read your visitors' cookies, send your page's text or run anyone else's code, and a translation can only ever change words. Pin it with the tag's fingerprint, watch its requests in your browser, and keep a strict policy if you have one: it is built to work inside those limits.

Sources

The pages this one cites, with the day each was read.

  1. 01Subresource Integrity (W3C Recommendation)w3.org, checked 30 October 2026
  2. 02Content Security Policy Level 3 (W3C)w3.org, checked 30 October 2026
  3. 03Global Privacy Controlglobalprivacycontrol.org, checked 30 October 2026
  • language switcher
  • website translation
Part of a guide

Book a demo

See LangRelay on your own site

Book 30 minutes with the team. We translate one of your pages live and walk through review, publishing and multilingual SEO.