Check 25.15 · Translating SEO elements

Translate dynamic content and CMS plugins

Translate the text produced by the theme, plugins, widgets and JavaScript: WordPress, Shopify, PrestaShop, Magento, Drupal, Laravel and Next.js.

Priority
Important
Difficulty
Intermediate
Estimated time
1 to 3 days
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

A translated page contains plenty of text that nobody entered in the editor: theme buttons and messages, labels from a booking plugin, catalog filters, stock notices, dates, review or chat widgets, text displayed by JavaScript after a click. It comes from language files, plugin settings or APIs, and often slips through content translation. Once this check is done, every source of dynamic text has been listed, its strings are translated in the right place, and the pages of each language no longer show fragments in the original language.

Why it matters

Google determines the language of a page from its visible content. A German product page whose filters, tabs, buy button and shipping messages stay in French is a mixed-language page: less clear for the visitor, less clear-cut for the search engine. See avoid mixed-language pages with partial translations (opens in a new tab).

These texts are often the ones that drive the action: “Add to cart”, “In stock, ships within 24 h”, “Book a slot”, form error messages. A visitor who does not understand the button or the shipping terms does not buy.

Text displayed by JavaScript raises an additional problem. Google runs JavaScript, but text loaded only after a user action, or served by an API that ignores the page's language, will not be seen in the right language. Not all generative engine crawlers run JavaScript: what they read is the initial HTML. See test SSR/SSG for all languages (opens in a new tab).

What it improves

  • Language consistency of translated pages, and therefore a clearer language signal.
  • Conversion Buttons, terms, stock and shipping messages that people understand.
  • Accessibility aria-label labels, status messages and screen reader text in the right language.
  • Citations in AI answers Practical information (shipping, availability) readable in the language of the question. An indirect effect, not guaranteed.
  • Maintenance Strings centralized in language files are updated once for every page.

How to check

Browse a translated version along a customer journey: home page, filtered list, product page, add to cart, cart, contact form with an error, internal search with no results, page 2 of a category, author or date archive. Note every text left in the source language and where it probably comes from.

Then find texts left in the source language in the initial HTML, by searching for phrases typical of the theme:

curl -s https://example.com/de/tees/gruener-tee/ | grep -o -i -E "ajouter au panier|lire la suite|en stock|livraison|rechercher|filtrer|trier par" | sort | uniq -c

Compare with the rendered DOM, in the browser console, after opening the filters and adding a product to the cart:

document.body.innerText.match(/ajouter au panier|lire la suite|en stock|livraison|rechercher|filtrer|trier par/gi);

A text present in the rendered DOM and absent from the initial HTML comes from JavaScript. For a site-wide check, see detect untranslated strings (opens in a new tab).

How to implement

Before you start

List the sources of dynamic text. The following table serves as the deliverable:

Source Example string Where it is translated Owner Status (de)
Theme language files “Lire la suite”, “Résultats de recherche pour” Theme .po/.json file or string translation tool Developer To do
Plugin settings Shipping banner text entered in the options Admin string translation Writer Done
Generated content “Catégorie : Thé vert”, “Page 2”, archive titles CMS or theme language files Developer To check
Catalog attributes “Couleur” and “Origine” filters, “Japon” values Attribute page, per language Writer To do
JavaScript text “Produit ajouté”, “Chargement…” Client-side language files Developer To do
Third-party widgets Customer reviews, chat, map, appointment booking Language setting of the third-party service Marketing To do
Formats Dates, prices, units Page locale (formatting functions) Developer Done

Common rules:

  • No hard-coded text in templates: every string goes through the platform's translation function.
  • The language comes from the URL, not from a cookie: an AJAX call must pass the page's language and the API must respond in that language.
  • Dates, numbers and currencies go through the locale's formatting functions. See adapt date and number formats (opens in a new tab).
  • Third-party widgets: set their language to the page's language (lang or locale parameter of the script, or per-language setting in the service). Customer reviews written by visitors are not translated as a matter of course; indicate their language.
  • Caches: a fragment cached without the language in its key serves text from another language. See check per-language cache handling (opens in a new tab).
  • Glossary: interface labels follow the same terminology as the content. See maintain a glossary and translation memory (opens in a new tab).

WordPress

Versions WordPress 6.5 to 7.1, WP-CLI 2.10 and later; WPML 4.x with String Translation, Polylang 3.x, Loco Translate 2.8.

Three possible origins, three tools:

  1. Strings in the code (theme, plugins): they go through __() or _e() and are translated in .po/.mo files. Public plugins often get their translations from translate.wordpress.org (Dashboard > Updates > Update Translations). To complete or correct them, use Loco Translate in the admin, or Poedit on the .po file. Custom files go in wp-content/languages/themes/ or wp-content/languages/plugins/ so that they survive updates.
  2. Text entered in settings (plugin options, widgets, site title): with WPML, the String Translation module (WPML > String Translation, link to translate texts in admin screens at the bottom of the page); with Polylang, Languages > Translations, which lists the title, tagline, widgets and strings registered by plugins.
  3. JavaScript strings: a script registered with wp_set_script_translations() reads JSON files generated from the .po.

To register a custom plugin's options for WPML and Polylang, use a wpml-config.xml file at the root of the plugin:

<wpml-config>
    <admin-texts>
        <key name="the_lisieres_options">
            <key name="shipping_banner" />
            <key name="booking_button_label" />
        </key>
    </admin-texts>
</wpml-config>

To make a child theme's strings translatable, including on the JavaScript side:

// child theme functions.php
add_action('init', function (): void {
    load_child_theme_textdomain('the-lisieres', get_stylesheet_directory() . '/languages');
});

add_action('wp_enqueue_scripts', function (): void {
    wp_enqueue_script('the-lisieres-cart', get_stylesheet_directory_uri() . '/js/cart.js', ['wp-i18n'], '1.0', true);
    wp_set_script_translations('the-lisieres-cart', 'the-lisieres', get_stylesheet_directory() . '/languages');
});
// js/cart.js
const { __ } = wp.i18n;

document.querySelector('.cart-notice').textContent = __('Produit ajouté au panier', 'the-lisieres');

Generate the files with WP-CLI: wp i18n make-pot . languages/the-lisieres.pot, translate in languages/the-lisieres-de_DE.po, then wp i18n make-json languages/ --no-purge, wp i18n make-mo languages/ and wp i18n make-php languages/: since WordPress 6.5, the .l10n.php file is read in preference to the .mo, and an old .l10n.php would hide your corrections. Dates go through wp_date(), which follows the active language.

Warning: with WPML, the option that looks for strings while pages are rendered is meant for diagnosis; do not leave it on in production. If a string does not appear, rescan the theme or plugin on the Theme and plugins localization page.

Shopify

Versions Online Store 2.0 themes and Translate & Adapt app, all Shopify plans, November 2026.

  • Theme text: it comes from the theme's locales/*.json files, called through the t filter ({{ 'products.product.add_to_cart' | t }}). Translate it in Translate & Adapt, in the theme section. Text hard-coded in a Liquid file appears in no tool: move it to locales/fr.default.json and call it with t.
  • Section and block settings (announcement bar, theme editor text), menus, filters, product options, metaobjects, email templates and app embeds in the theme: these are translatable resources according to the Shopify API, to be handled in Translate & Adapt or a translation app.
  • Third-party apps (reviews, loyalty, shipping): their widgets often have their own language settings in the app. Check each app on the translated version.

PrestaShop

Versions PrestaShop 8 and 9.

Interface strings are translated in International > Translations, in the block for modifying translations: choose the type (theme, installed modules, emails, back office), the language, then search for the string. Only modules compatible with this system appear there; for the others, edit the module's translation files. Attributes and features (Catalog > Attributes & Features) and module configuration texts are translated per language with the language selector of each field.

Magento

Versions Magento Open Source and Adobe Commerce 2.4.

Create one dictionary per language in the theme, app/design/frontend/Vendor/theme/i18n/de_DE.csv:

"Add to Cart","In den Warenkorb"
"In stock","Auf Lager"
"Free shipping from %1","Kostenloser Versand ab %1"

To list the strings to translate: bin/magento i18n:collect-phrases -o phrases.csv app/design/frontend/Vendor/theme. JavaScript strings are compiled at deployment: bin/magento setup:static-content:deploy de_DE, then bin/magento cache:flush. CMS blocks, attributes and option labels are translated per store view. In developer mode, inline translation (Stores > Configuration > Advanced > Developer > Translate Inline) helps find where a string comes from.

Drupal

Versions Drupal 10 and 11, Drush 12 and 13.

  • Interface strings (Interface Translation module): Configuration > Regional and language > User interface translation (/admin/config/regional/translate), with a filter on untranslated strings. Import community translations with drush locale:check, then drush locale:update.
  • Configuration (Configuration Translation module): block titles, views, menus, field labels and forms are translated in /admin/config/regional/config-translation.

Laravel

Versions Laravel 11 to 13.

Every string goes through __() and the files in lang/ (published with php artisan lang:publish):

{{-- resources/views/products/show.blade.php --}}
<button type="submit">{{ __('cart.add') }}</button>

<p>{{ trans_choice('stock.remaining', $product->stock, ['count' => $product->stock]) }}</p>

<time datetime="{{ $product->shipsAt->toDateString() }}">
    {{ $product->shipsAt->locale(app()->getLocale())->isoFormat('LL') }}
</time>

For text displayed by JavaScript, expose the current language's strings in the page rather than coding them into the script:

<script>
    window.translations = @json(__('frontend'));
</script>

AJAX responses must receive the language: prefix API routes with the locale or send it explicitly, then call App::setLocale() in a middleware.

Next.js

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

With next-intl, server components read messages with getTranslations and client components with useTranslations. With next-intl 4, a NextIntlClientProvider rendered in a server component passes all the language's messages to client components by default. If you limit those messages with the messages prop to lighten the page, check that the namespaces you need are included.

// app/[locale]/tees/[slug]/AddToCart.tsx
'use client';

import { useFormatter, useTranslations } from 'next-intl';

export function AddToCart({ price, shipsAt }: { price: number; shipsAt: Date }) {
  const t = useTranslations('Cart');
  const format = useFormatter();

  return (
    <div>
      <p>{format.number(price, { style: 'currency', currency: 'EUR' })}</p>
      <p>{t('shipsOn', { date: format.dateTime(shipsAt, { dateStyle: 'long' }) })}</p>
      <button type="button">{t('add')}</button>
    </div>
  );
}

Calls to an API or a headless CMS must pass the route's locale: content fetched without a language parameter comes back in the default language.

Common mistakes

  • Translating the content and forgetting the theme: archive titles, pagination, “Read more”, breadcrumbs, empty search messages.
  • Editing a plugin's language files directly in its folder: the next update overwrites them.
  • Leaving WPML's live string lookup option on in production.
  • Hard-coded text in a Liquid, Blade or JSX file, invisible to every translation tool.
  • AJAX requests without a language: filters and carts that respond in French on the German version.
  • Third-party widgets configured only once, in the primary language.
  • Fragment cache shared between languages: the first language visited contaminates the others.
  • Dates and prices formatted by hand (d/m/Y, a hard-coded “12,50 €”) instead of the locale's functions.

Frequently asked questions

Why does some text in my WordPress theme stay in French after translation?

That text does not come from the page content but from the theme, a plugin or a setting. Strings in the code are translated in .po files, with Loco Translate or Poedit; text entered in the options goes through WPML's or Polylang's string translation. Text hard-coded in a theme file, without a translation function, appears nowhere: the code has to be fixed.

Does Google take text displayed by JavaScript into account?

Google runs JavaScript and can see text inserted when the page loads. However, text that only appears after a click, or that is served by an API without regard to the page's language, will not be seen in the right language. Not all generative engine crawlers run JavaScript. Serve important translated text in the initial HTML.

How do you translate third-party widgets such as customer reviews or chat?

Each third-party service handles its own language. Look in its documentation for a language parameter in the embed script, or a per-language setting in its dashboard, and feed it the page's language rather than the browser's. Reviews written by customers stay in their original language: preferably show those in the page's language.

Should plugin messages be translated into the language of each country?

Yes, for everything a visitor reads: buttons, confirmation messages, shipping terms, form errors, booking text. Public plugins often already have community translations to install or complete; review them, because the vocabulary sometimes differs from yours. Text entered in their settings, on the other hand, is never translated automatically.

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