Check 25.11 · Translating SEO elements

Translate error messages and 404 pages

Translate the 404 page, the 500 and maintenance pages and the site's error messages into each language, keeping the right HTTP status codes, from server to framework.

Priority
Important
Difficulty
Intermediate
Estimated time
2 h to 1 day
Free, no account: your progress is saved in this browser.

Ask an AI to check this point on your site

Opens the assistant with a ready-made question: this check, its goal and your site URL.

For Gemini, Copilot or another assistant, copy the question. The link opens the chosen service directly: nothing goes through this site.

In short

Error messages are the most frequently forgotten texts on a multilingual site: 404 page, server error page, maintenance page, search with no results, product unavailable, payment or login error. They are produced by the server, the CDN (Content Delivery Network), the CMS or the application, each with its own files. This check consists of listing them and translating them into each language, without changing the HTTP status codes. Once it is done, a visitor who hits an error in the German version reads a German message, with links that take them back into the German version.

Why it matters

An error is a moment when the visitor decides to stay or leave. A 404 page in the default language, with a link to the French home page, pushes a visitor who arrived through a broken link or an old search result out of their version; a French maintenance page shown across the whole site leaves the other markets without an explanation.

For search engines, the text matters less than the HTTP status code: a 404 page must return 404, temporary unavailability 503. Translating an error page must never lead to serving it with a 200 code or redirecting to the home page, which Google treats as soft 404s; see fix soft 404s (opens in a new tab). Routing the 404 to the right language, on which everything else depends, is covered in check localized 404 errors (opens in a new tab).

AI agents browsing a site read error messages to decide their next action. An explicit message, in the language of the page, is more useful to them than a raw error code; see provide clear error messages (opens in a new tab).

What it improves

  • Retention A lost visitor stays in their language and finds a way back to the sections of their version.
  • Trust An error explained in the visitor's language looks under control, especially during payment or maintenance.
  • Crawling Error page links that stay within the version, without creating soft 404s if the status codes are respected.
  • AI agents Readable messages that make it possible to correct an entry or try again.
  • Rankings No direct effect. 404s on URLs that do not exist do not penalize the rest of the site.

How to check

Request a non-existent URL under each language prefix and check the status code, the declared language and the title:

for p in fr de en; do
  u="https://example.com/$p/page-inexistante-test-404"
  printf '%s  ' "$u"
  curl -s -o /tmp/erreur.html -w '%{http_code}  ' "$u"
  grep -o -i -E '<html[^>]*lang="[^"]*"|<title>[^<]*</title>' /tmp/erreur.html | tr '\n' ' '
  echo
done

Compliant result:

https://example.com/de/page-inexistante-test-404  404  <html lang="de"> <title>Seite nicht gefunden</title>

Then check by hand, in each language:

  • Search with no results: https://example.com/de/suche?q=zzqxw shows a German message and suggestions from that version.
  • Forms and account: wrong credentials, forgotten password with an unknown address, empty required field.
  • Commerce: out-of-stock product, invalid promo code, payment declined with a test card from the payment provider, in a test environment.
  • Server error and maintenance pages: on a staging environment, stop the application or turn on maintenance mode, then request a page in each language.
  • CDN or firewall errors: Cloudflare block or challenge page, the host's error page.

In Search Console, the “Soft 404” reason in the Page indexing report flags error pages served with a 200 code.

How to implement

Before you start

List the error messages and their source. Example for a shop translated into German:

Situation HTTP code Text (de) Source
Page not found 404 Seite nicht gefunden 404 template of the theme or application
Content removed 410 Diese Seite wurde entfernt 410 or 404 template
Server error 500 Ein Fehler ist aufgetreten Static page of the server or application
Maintenance 503 Wartungsarbeiten, wir sind bald zurück Maintenance page
Empty search 200 Keine Ergebnisse für „…“ Search template
Out of stock 200 Derzeit nicht vorrätig Theme or CMS language files
Payment declined — Zahlung abgelehnt, bitte versuchen Sie es erneut Payment provider, checkout
Firewall block 403 CDN page CDN or host

Writing rules, valid for every environment:

  • Say what happened and what to do, in the language of the URL: “This page does not exist or has been moved”, then a search box, the home page and the main sections in the same language.
  • Do not change the status code: the translated page keeps its 404, 410, 500 or 503 code. What a useful 404 page contains is detailed in create a helpful 404 page (opens in a new tab).
  • Declare the language: <html lang="de"> and a translated <title>; neither hreflang nor canonical on an error page.
  • Pages that must work without the application (500, 502, 503): these are static files, served when the application no longer responds. Create one per language if the server can choose based on the URL; otherwise, a single page that shows a short message in each language of the site.
  • No technical text: no stack trace and no exception message, whatever the language.

Apache

Versions Apache 2.4.

For static server error and maintenance pages, one ErrorDocument directive per language, in the virtual host or in the root .htaccess (Apache 2.4):

ErrorDocument 500 /errors/500.html
ErrorDocument 503 /errors/503.html

<If "%{THE_REQUEST} =~ m#^\S+ /de/#">
    ErrorDocument 500 /errors/500-de.html
    ErrorDocument 503 /errors/503-de.html
</If>

<If "%{THE_REQUEST} =~ m#^\S+ /en/#">
    ErrorDocument 500 /errors/500-en.html
    ErrorDocument 503 /errors/503-en.html
</If>

THE_REQUEST contains the original request line (GET /de/... HTTP/1.1): the condition stays true even when a rewrite rule has sent the request to index.php. Always give a local path: with a full URL, Apache redirects and the error code is lost. These directives cover errors produced by Apache itself, for example a 503 when PHP-FPM stops responding; an error page returned by the application keeps its own content. Test, then reload: sudo apachectl configtest && sudo systemctl reload apache2.

Nginx

Versions Nginx 1.24 and later.

Choose the page from the original URL with a map, which still works after the internal redirect to index.php:

# http context, for example /etc/nginx/conf.d/error-pages.conf
map $request_uri $error_suffix {
    default "";
    ~^/de/  "-de";
    ~^/en/  "-en";
}
# Site server block
error_page 500 502 503 504 /errors/50x$error_suffix.html;

location ^~ /errors/ {
    internal;
}

Create /errors/50x.html, /errors/50x-de.html and /errors/50x-en.html in the site root. Without further settings, these pages replace errors produced by Nginx (application unreachable, timeout). For them to also replace 5xx errors returned by PHP, add fastcgi_intercept_errors on; in the location ~ \.php$ block; since no error_page 404 is declared, the application's 404s stay intact. Do not write error_page 503 = /errors/50x-de.html: the = sign would substitute the code of the page served. Reload with sudo nginx -t && sudo systemctl reload nginx.

Cloudflare

Versions Cloudflare dashboard, Pro, Business and Enterprise plans, November 2026.

Cloudflare passes on the origin's error pages without changing them. Its own pages (5xx and 1xxx errors generated by Cloudflare, firewall blocks, challenges, rate limiting) are customized on the zone's Error Pages page: one page per error type, hosted by you, which Cloudflare fetches and stores. There is only one page per type, not one per language: write a short page with a paragraph in each language of the site, or a script that picks the text from the prefix of the requested URL.

Custom Error Rules (Rules > Overview, Rules Overview, then Create rule > Custom Error Rule) replace the content of error responses based on an expression, for example the response code, and take precedence over Error Pages. Check in the expression editor whether your plan lets you combine the code and the URL path to serve one page per language. Both Error Pages and Custom Error Rules are limited to paid plans: on the Free plan, Cloudflare shows its default pages.

After editing the hosted page, open the … menu of the page type and choose “Fetch custom error page again”: Cloudflare does not reread it on its own.

WordPress

Versions WordPress 6.4 to 7.1; Yoast SEO 20 and later, with WPML 4 or Polylang 3.

  • 404 page: the texts of the 404.php template (or the 404 template of a block theme) come from the theme's language files. Complete them with Loco Translate, or translate the 404 template in the Site Editor with your multilingual plugin. With WPML or Polylang and languages in subdirectories, the language is inferred from the URL prefix.
  • Yoast breadcrumb 404 item (“Error 404: Page not found”): a single setting to translate in Languages > Translations (Polylang) or WPML > String Translation.
  • Search with no results: search.php template or search template, same language files.
  • WooCommerce: stock, cart, coupon and payment messages use WooCommerce's language files; payment gateway messages come from their plugin.
  • Maintenance: WordPress shows a minimal message during updates. For planned maintenance, a static multilingual maintenance.html page served by the server (see Apache or Nginx) is more reliable than a plugin that depends on WordPress.

Shopify

Versions Shopify, Horizon and Dawn themes, Translate & Adapt app, November 2026.

In Dawn and themes of the same generation, the 404 template shows texts from the locale file (keys in the general.404 family). In Horizon, the title and text of the 404 page are text blocks of the 404 template, editable in the theme editor. In both cases, translate them in Translate & Adapt, in the theme content section. Messages for empty search, stock and cart are also theme strings. Checkout and its error messages are provided by Shopify in the published language. Test a non-existent URL under each language prefix (/de/products/xyz).

PrestaShop

Versions PrestaShop 8 and 9, Classic and Hummingbird themes.

The 404 page is the theme's templates/errors/404.tpl template, in both Classic and Hummingbird (the default theme since PrestaShop 9.1); its texts, like those of search and cart, are translated in International > Translations, theme translations. The maintenance page (Shop Parameters > General > Maintenance) has one text field per language.

Magento

Versions Magento Open Source and Adobe Commerce 2.4 (2.4.6 to 2.4.9).

The 404 page is a CMS page (no-route by default): create a version for each store view in Content > Pages or assign a different page to each view in Stores > Configuration > General > Web > Default Pages. Module error messages go through the i18n/xx_XX.csv files. The maintenance page is in pub/errors/; it is served without the framework, so write it in several languages.

Laravel

Versions Laravel 10 to 13.

Error views go in resources/views/errors/ (404.blade.php, 500.blade.php, 503.blade.php) and use __() like other views. Two pitfalls specific to errors:

  • The language of 404s: a URL that matches no route does not go through your routes' language middleware, and the view is rendered in the default language. Set the language from the URL prefix when rendering the exception; the full method, for bootstrap/app.php (Laravel 11 to 13; app/Exceptions/Handler.php in Laravel 10), is in check localized 404 errors (opens in a new tab).
  • The pre-rendered maintenance page: php artisan down --render="errors::503" renders the view once, before the application loads, and therefore in a single language. Write this view with a short message in each language:
{{-- resources/views/errors/503.blade.php --}}
<!DOCTYPE html>
<html lang="fr">
<head>
    <meta charset="utf-8">
    <title>Maintenance – Wartung – Maintenance</title>
</head>
<body>
    <section lang="fr">
        <h1>Maintenance en cours</h1>
        <p>Le site revient dans quelques minutes.</p>
    </section>
    <section lang="de">
        <h1>Wartungsarbeiten</h1>
        <p>Die Website ist in wenigen Minuten wieder erreichbar.</p>
    </section>
    <section lang="en">
        <h1>Maintenance in progress</h1>
        <p>The site will be back in a few minutes.</p>
    </section>
</body>
</html>

The lang attribute on each section tells screen readers the language of each passage.

Next.js

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

The per-language 404 page (app/[locale]/not-found.tsx with a catch-all route that calls notFound()) is described in check localized 404 errors (opens in a new tab). For runtime errors, error.tsx is a client component: with next-intl, its messages must be available on the client (NextIntlClientProvider in the language layout). app/global-error.tsx replaces the root layout and does not receive the language's messages: give it a short text in each language, as for the maintenance page.

Next.js 16.3 and later

The component receives retry, stable since Next.js 16.3, which reloads the segment's data before rendering it again:

// app/[locale]/error.tsx
'use client';

import { useTranslations } from 'next-intl';

export default function Error({ retry }: { error: unknown; retry: () => void }) {
  const t = useTranslations('ErrorPage');

  return (
    <main>
      <h1>{t('title')}</h1>
      <p>{t('description')}</p>
      <button onClick={() => retry()}>{t('retry')}</button>
    </main>
  );
}

Next.js 15 to 16.2

The component receives reset, which renders the segment again without reloading its data:

// app/[locale]/error.tsx
'use client';

import { useTranslations } from 'next-intl';

export default function Error({ reset }: { error: Error & { digest?: string }; reset: () => void }) {
  const t = useTranslations('ErrorPage');

  return (
    <main>
      <h1>{t('title')}</h1>
      <p>{t('description')}</p>
      <button onClick={() => reset()}>{t('retry')}</button>
    </main>
  );
}

Common mistakes

  • Translating the 404 page and forgetting the others: empty search, stock, payment, maintenance.
  • Translated error page served with a 200 code, or redirected to the language's home page: soft 404s.
  • Error page links to the French version: home page, search and sections must stay in the language of the URL.
  • Single-language maintenance page shown to every version, often during the longest operations.
  • Technical messages (exception, class name, stack trace) shown to the visitor, translated or not.
  • Forgotten CDN error pages: they appear precisely when the site is in trouble.

Frequently asked questions

Should the 404 page be translated for each language?

Yes, each language version should show its own 404 page in its language, with links to the home page, the search and the main sections of that version. The HTTP status code must stay 404, with no redirect. Translation alone is not enough: the application or the server must also infer the language from the requested URL, otherwise the translated page never shows for unknown URLs.

How do you translate a maintenance page shown while the site is down?

A maintenance page is often served without the application, by the server, the CDN or a pre-rendered version, so it does not know the visitor's language. The most reliable solution is a single static page, with a short message in each language of the site, served with a 503 code. If the server can choose based on the URL prefix, one page per language is better.

Can a translated 404 page be indexed by mistake?

Only if it is served with a 200 code or through a redirect to a normal page. A translated 404 page returned with a 404 code is not indexed, whatever its language. Check the status code with curl on a non-existent URL in each language, and monitor the Soft 404 reason in the Page indexing report in Search Console.

Should form and payment error messages be translated?

Yes, they are error messages like any other, and they appear just as the visitor is about to convert. Input errors come from the browser, the form plugin or the framework; payment errors from the provider or the checkout. Test each case in each language, with the provider's test cards, in a test environment.

Updated on

Topic checklist (PDF)

And now?

In the “Translating SEO elements” topic

  1. Translate titles and meta descriptions
  2. Translate H1/H2/H3 headings
  3. Translate the main content
  4. Translate slugs
  5. Translate ALT text and captions
  6. Translate anchors, menus and footer
  7. Translate breadcrumbs and FAQs
  8. Translate text properties in structured data
  9. Translate Open Graph and set og:locale
  10. Translate CTAs and forms
  11. Translate error messages and 404 pages
  12. Translate cookie banners
  13. Translate downloadable documents
  14. Translate subtitles and transcripts
  15. Translate dynamic content and CMS plugins
  16. Check text embedded in images
  17. Detect untranslated strings