# Integrate multilingual tests into CI/CD

- Check 30.23 · Multilingual tracking and maintenance · Important
- Source: https://checklist-seo-geo.com/en/multilingual-tracking-maintenance/integrate-multilingual-tests-into-ci-cd
- Add multilingual tests to GitHub Actions or GitLab CI: translation keys and variables, the build of each language, lang, hreflang and canonical.
- Updated on 2026-11-25
- Licence: CC BY 4.0. Credit “Checklist SEO & GEO” with a link to https://checklist-seo-geo.com/en/multilingual-tracking-maintenance/integrate-multilingual-tests-into-ci-cd.
- Plugin checklist-seo-geo: 1.3.1 · https://github.com/maximegaul/checklist-seo-geo

## In short

Continuous integration (CI) runs tests on every merge request; continuous deployment (CD) puts live whatever has passed them. Integrating multilingual tests into them means making the pipeline fail when a translation key is missing in a language, a variable has disappeared from a sentence, a language no longer builds, or the rendered page loses its `lang`, its `hreflang` tags or its `canonical`. Once this is in place, these regressions are blocked before going to production, instead of being discovered in Search Console.

## Why it matters

Most multilingual regressions originate in an innocuous code change: a new string added in French only, a key renamed in one file and not in the others, a `{count}` variable mistakenly translated as `{nombre}`, a route added without its translated equivalent, a refactored `<head>` component that forgets the `hreflang` tags. No developer rereads five language files on every merge request.

The consequences show up in production: raw keys like `checkout.cta` displayed to visitors, German pages with passages in English, versions that lose their annotations. For search engines, a mixed-language page or a page without `hreflang` is less relevant for its market; for generative engines, it is lower-quality text to cite.

The post-deployment checks described in [test all versions after each deployment](https://checklist-seo-geo.com/en/multilingual-tracking-maintenance/test-all-versions-after-each-deployment) detect these errors once they are live. CI stops them from getting there. The two complement each other. For general SEO, performance and accessibility tests, see [integrate SEO, performance and accessibility tests into CI/CD](https://checklist-seo-geo.com/en/automation-quality-control/integrate-seo-performance-accessibility-tests-into-ci-cd).

## What it improves

- **Completeness of translations**: no missing or empty key reaches production.
- **Pages without raw strings or mixed languages**, see [detect the actual language and untranslated strings](https://checklist-seo-geo.com/en/multilingual-tracking-maintenance/detect-actual-language-untranslated-strings).
- **Stability of each language's SEO signals**: `lang`, `hreflang`, `canonical`, `noindex`.
- **Cost**: an error fixed in the merge request costs less than an incident in production.
- **Rankings**: no direct effect; the tests prevent losses.

## How to check

Open a test merge request that deletes a key in a secondary language file, and another that removes the `hreflang` tags from the template. Both pipelines must fail, with a message naming the faulty language, key or page. Finally, check in the repository settings that these checks are required for merging (protection rule on the main branch). A test that fails without blocking the merge is just a warning.

## How to implement

### Before you start

Three levels of tests, from the fastest to the most complete:

| Level | What it checks | Duration | When |
|---|---|---|---|
| Translation files | Missing, extra or empty keys, different variables, syntax | Seconds | Every merge request |
| Build and rendering | Each language builds, each translated route responds, no raw strings | Minutes | Every merge request |
| SEO output | `html lang`, `hreflang`, `canonical`, `noindex`, sitemap per language | Minutes | On the preview of each merge request, or before going to production |

Start with the first level: it catches most errors at minimal cost.

This dependency-free Python script compares JSON translation files with a reference language. It suits next-intl, Nuxt i18n or i18next messages, Laravel's JSON files and a theme's `locales/*.json` files:

```python
#!/usr/bin/env python3
"""Usage: python3 check_i18n.py messages/fr.json messages/en.json messages/de.json
The first file is the reference."""
import json
import re
import sys

NAMES = [
    re.compile(r"\{\{\s*([\w.]+)\s*\}\}"),       # {{ name }}: Liquid, i18next
    re.compile(r"\{\s*([A-Za-z_][\w.]*)\s*[,}]"),  # {name}, {count, plural, ...}: ICU
    re.compile(r":([A-Za-z_]\w*)"),               # :name: Laravel
    re.compile(r"(%(?:\d+\$)?[sd])"),             # %s, %1$s: printf
]


def flatten(node, prefix=""):
    if not isinstance(node, dict):
        return {prefix: node}
    result = {}
    for key, value in node.items():
        result.update(flatten(value, f"{prefix}.{key}" if prefix else key))
    return result


def placeholders(text):
    if not isinstance(text, str):
        return set()
    return {name for pattern in NAMES for name in pattern.findall(text)}


def load(path):
    try:
        return flatten(json.load(open(path, encoding="utf-8")))
    except json.JSONDecodeError as error:
        print(f"ERROR {path}: invalid JSON ({error})")
        sys.exit(1)


reference_path, *others = sys.argv[1:]
reference = load(reference_path)
errors = 0

for path in others:
    messages = load(path)
    for key in sorted(reference.keys() - messages.keys()):
        print(f"ERROR {path}: missing key {key}")
        errors += 1
    for key in sorted(messages.keys() - reference.keys()):
        print(f"ERROR {path}: key unknown in the reference {key}")
        errors += 1
    for key in sorted(reference.keys() & messages.keys()):
        value = messages[key]
        if value in ("", None):
            print(f"ERROR {path}: empty value {key}")
            errors += 1
        elif placeholders(value) != placeholders(reference[key]):
            print(f"ERROR {path}: different variables {key}: {sorted(placeholders(value))} / {sorted(placeholders(reference[key]))}")
            errors += 1
        elif isinstance(value, str) and len(value) > 20 and value == reference[key]:
            print(f"WARNING {path}: text identical to the reference {key}")

print(f"{len(others)} file(s) compared, {errors} error(s).")
sys.exit(1 if errors else 0)
```

Texts identical to the reference only trigger a warning: brand names and technical terms often stay the same. For a Laravel project whose JSON files use the source sentences as keys, use as the reference the language whose file is complete.

### With GitHub Actions

Versions: GitHub Actions, November 2026.

The `.github/workflows/i18n.yml` file, for a Next.js project with next-intl:

```yaml
name: Multilingual tests

on:
  pull_request:
  push:
    branches: [main]

jobs:
  traductions:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-python@v5
        with:
          python-version: '3.13'
      - name: Translation file consistency
        run: python3 scripts/check_i18n.py messages/fr.json messages/en.json messages/de.json messages/es.json

  rendu:
    runs-on: ubuntu-latest
    needs: traductions
    steps:
      - uses: actions/checkout@v6
      - uses: actions/setup-node@v4
        with:
          node-version: '24'
          cache: npm
      - run: npm ci
      - run: npx tsc --noEmit
      - run: npm run build
      - run: npx playwright install --with-deps chromium
      - run: npx playwright test tests/i18n.spec.ts
```

In the repository's `Settings > Branches` (or `Settings > Rules`), make both jobs required before merging into `main`. To test the SEO output on the preview deployed by Vercel or Netlify, run the smoke test script with the `--base` option on the preview URL, as described in [test all versions after each deployment](https://checklist-seo-geo.com/en/multilingual-tracking-maintenance/test-all-versions-after-each-deployment).

### With GitLab CI

Versions: GitLab CI/CD, November 2026.

The equivalent `.gitlab-ci.yml` file:

```yaml
stages:
  - traductions
  - rendu

traductions:
  stage: traductions
  image: python:3.13-slim
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  script:
    - python3 scripts/check_i18n.py messages/fr.json messages/en.json messages/de.json messages/es.json

rendu:
  stage: rendu
  image: node:24
  rules:
    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
  script:
    - npm ci
    - npx tsc --noEmit
    - npm run build
    - npx playwright install --with-deps chromium
    - npx playwright test tests/i18n.spec.ts
```

In `Settings > Merge requests`, `Merge checks` section, tick `Pipelines must succeed`.

### Next.js

Versions: Next.js 15 and 16 (App Router), next-intl 4, Playwright 1.5x.

Three checks add up:

1. **Message typing**: by declaring the type of messages from the reference language (`Messages: typeof messages` in next-intl's `AppConfig` interface), `tsc --noEmit` rejects any key used in the code that does not exist in that file. It does not check the other languages: that is the script's job.
2. **Consistency script**: it compares each file in `messages/` with the reference.
3. **Rendering test**: `npm run build` fails if static generation crashes for a language, then Playwright checks the output of each language.

```ts
// tests/i18n.spec.ts
import { test, expect } from '@playwright/test';

const pages = [
  { path: '/fr/tarifs', lang: 'fr' },
  { path: '/en/pricing', lang: 'en' },
  { path: '/de/preise', lang: 'de' },
  { path: '/es/precios', lang: 'es' },
];

for (const { path, lang } of pages) {
  test(`${path} is served in ${lang} with its hreflang tags`, async ({ page }) => {
    const response = await page.goto(path);
    expect(response?.status()).toBe(200);
    await expect(page.locator('html')).toHaveAttribute('lang', lang);
    await expect(page.locator('link[rel="alternate"][hreflang]')).toHaveCount(5);
    await expect(page.locator('link[rel="canonical"]')).toHaveAttribute('href', `https://example.com${path}`);
    await expect(page.locator('meta[name="robots"][content*="noindex"]')).toHaveCount(0);
    await expect(page.locator('body')).not.toContainText(/\b[A-Z][a-zA-Z]+\.[a-z][a-zA-Z.]+\b/);
  });
}
```

The expected number of `hreflang` tags (`5`) here corresponds to four languages plus `x-default`. The last assertion looks for raw keys such as `Pricing.title` in the text: adjust the expression to the shape of your keys if it produces false positives. In `playwright.config.ts`, start the built application before the tests:

```ts
import { defineConfig } from '@playwright/test';

export default defineConfig({
  use: { baseURL: 'http://localhost:3000' },
  webServer: { command: 'npm run start', url: 'http://localhost:3000', reuseExistingServer: false },
});
```

### Nuxt

Versions: Nuxt 4, with the @nuxtjs/i18n module.

The language files are JSON (or YAML) in the `i18n/locales/` folder or the one defined by `langDir`: pass them to the consistency script. Add `nuxt build` (or `nuxt generate` for a static site) to the pipeline, then the same Playwright test as for Next.js, adapted to your routes.

### Laravel

Versions: Laravel 12 and 13.

A PHPUnit test checks that each language has the same keys as the reference language, for JSON files as well as for the PHP files in `lang/`:

```php
namespace Tests\Unit;

use Illuminate\Support\Arr;
use Illuminate\Support\Facades\File;
use Tests\TestCase;

class TranslationsTest extends TestCase
{
    private const REFERENCE = 'fr';

    private const LOCALES = ['en', 'de', 'es'];

    public function test_every_php_language_file_has_the_reference_keys(): void
    {
        foreach (File::files(lang_path(self::REFERENCE)) as $file) {
            $reference = array_keys(Arr::dot(require $file->getPathname()));

            foreach (self::LOCALES as $locale) {
                $path = lang_path("{$locale}/{$file->getFilename()}");

                $this->assertFileExists($path);

                $keys = array_keys(Arr::dot(require $path));

                $this->assertSame([], array_values(array_diff($reference, $keys)), "Missing keys in {$path}");
            }
        }
    }

    public function test_every_json_language_file_has_the_same_keys(): void
    {
        $reference = array_keys(json_decode(File::get(lang_path('en.json')), true));

        foreach (File::glob(lang_path('*.json')) as $path) {
            $keys = array_keys(json_decode(File::get($path), true));

            $this->assertSame([], array_values(array_diff($reference, $keys)), "Missing keys in {$path}");
            $this->assertSame([], array_values(array_diff($keys, $reference)), "Extra keys in {$path}");
        }
    }
}
```

The JSON test uses English as the reference, because Laravel's JSON files often use the source-language sentences as keys, with no file for that language. Add a feature test per language that checks the status, `lang`, `hreflang` tags and `canonical` of the translated routes, and run `php artisan test` in the pipeline.

### Symfony

Versions: Symfony 7.4 and 8.0.

Symfony provides the commands you need:

```bash
php bin/console lint:yaml translations --format=github
php bin/console lint:xliff translations --format=github
php bin/console lint:translations
php bin/console debug:translation de --only-missing
```

`lint:yaml` and `lint:xliff` check the syntax of the files, `lint:translations` the content of the messages in every language. `debug:translation` lists the missing messages for a language and returns a non-zero exit code when some are missing: run it for each published language. The `github` format displays errors directly in the merge request.

### WordPress

Versions: WordPress 6.5 and later, WP-CLI 2.10 and later, GNU gettext.

For a custom theme or plugin, interface strings live in `.po` files. Regenerate the template, merge it into each language, then fail if any untranslated or fuzzy strings remain:

```bash
wp i18n make-pot . languages/mon-theme.pot
for po in languages/*.po; do
  msgmerge --quiet --update --backup=none "$po" languages/mon-theme.pot
  msgfmt --check -o /dev/null "$po" || exit 1
  stats=$(LC_ALL=C msgfmt --statistics -o /dev/null "$po" 2>&1)
  echo "$po: $stats"
  if echo "$stats" | grep -q -E "untranslated|fuzzy"; then
    exit 1
  fi
done
```

`msgfmt --check` checks, among other things, that the `%s` and `%1$s` variables match between source and translation. Content translated with WPML or Polylang is in the database, outside the repository: test it on the staging environment with the smoke test, after each update.

### Shopify

Versions: Shopify CLI 3, Theme Check, November 2026.

Theme Check, built into the Shopify CLI, includes the `MatchingTranslations` check, which reports missing or extra keys in the `locales/*.json` files compared with the theme's default language. In the pipeline:

```bash
npm install -g @shopify/cli
shopify theme check
```

Check that `MatchingTranslations` is not disabled in the theme's `.theme-check.yml` file, and that the command fails on its alerts; depending on the CLI version, an option sets the severity level that makes the command fail. Content translations made in Translate & Adapt are not in the repository: check them with the CSV export of untranslated or outdated translations.

> **Warning:** do not fix a red test by adding the missing key with the reference language's text. The test passes, but the page displays French in the German version. A missing key must go out for translation; in the meantime, block the merge or hide the feature in that language.

## Common mistakes

- **Non-required tests**: the pipeline is red, and the merge request goes through anyway.
- **Copying the reference language** into missing keys to make the test pass.
- **Testing only the default language** in rendering tests.
- **Comparing keys without comparing variables**: `{count}` translated as `{nombre}` breaks the display without any missing key.
- **A pipeline that is too slow**: beyond a few minutes, the team ends up bypassing it. Keep the file checks in a separate, fast job.
- **Forgetting content outside the repository** (CMS, database, translation app), which falls under post-deployment testing.
- **Testing the SEO output with the production domain's canonical** on a preview, then ignoring all the alerts.

## Frequently asked questions

### How do you automatically detect missing translations in a project?

On every merge request, compare each language's translation files with those of a reference language: missing keys, extra keys, empty values and different variables. A script of a few dozen lines is enough for JSON files; Symfony provides debug:translation, Shopify the MatchingTranslations check in Theme Check, and gettext the msgfmt command for WordPress .po files. Make this check required before merging.

### Which multilingual SEO tests should you automate in CI/CD?

First automate the consistency of the translation files, then the build of each language, then the HTML output of a sample of pages per language: 200 code, lang attribute, all hreflang annotations present, canonical pointing to the page itself and no noindex. These checks run in a few minutes. A full crawl of the links between languages is better suited to a scheduled check outside the pipeline.

### Should you block a merge because of a missing translation?

Yes, if the missing string is displayed to visitors. Otherwise, it goes to production as a raw key or as text in the reference language, and creates mixed-language pages. If the translation takes time, hide the new feature in the languages that are not ready rather than copying the source text. A test that is only a warning always ends up ignored.

### Are multilingual tests in CI enough without post-deployment tests?

No. CI checks the code and the files in the repository, on a test environment. It sees neither the content translated in the CMS, nor production caches and CDN, nor the real environment variables. Keep a smoke test on a sample of URLs in each language right after each production release: the two checks cover different risks.

## Resources

- [GitHub Docs: about protected branches and required status checks](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches)
- [GitLab Docs: require a successful pipeline to merge](https://docs.gitlab.com/user/project/merge_requests/auto_merge/)
- [next-intl: TypeScript integration](https://next-intl.dev/docs/workflows/typescript)
- [Playwright: assertions](https://playwright.dev/docs/test-assertions)
- [Symfony: translations, debug and lint commands](https://symfony.com/doc/current/translation.html)
- [Shopify: MatchingTranslations check](https://shopify.dev/docs/storefronts/themes/tools/theme-check/checks/matching-translations)
- [GNU gettext: msgfmt](https://www.gnu.org/software/gettext/manual/html_node/msgfmt-Invocation.html)
- [WP-CLI: wp i18n make-pot](https://developer.wordpress.org/cli/commands/i18n/make-pot/)

Next steps: [Automate hreflang and canonical tests](https://checklist-seo-geo.com/en/multilingual-tracking-maintenance/automate-hreflang-canonical-tests) and [Detect the actual language and untranslated strings](https://checklist-seo-geo.com/en/multilingual-tracking-maintenance/detect-actual-language-untranslated-strings).
