Translate WooCommerce Product Filter Labels: Polylang, WPML, Loco
On a multilingual shop the product filter often ends up half translated: the colour names switch language, but the block titles, the Filter button or Clear All stay in the original. The filter shows texts from several sources, and each one is translated in a different place. This guide shows how to translate WooCommerce product filter labels with Polylang, WPML or Loco Translate, source by source, with the exact syntax the plugin expects.
Where each filter text comes from
| Text in the filter | Where it comes from | Where to translate it |
|---|---|---|
| Term names: categories, colours, sizes | WordPress terms | Your multilingual plugin, like any category or attribute term |
| Block titles without a custom label | The taxonomy name, for attributes "Product Color" and so on | Your multilingual plugin, or better a custom label (below) |
| Texts you typed in the filter settings: custom labels, button texts, placeholders, toggle and Show more texts, tooltips, meta filter titles and options, section titles | HUSKY settings | WPML taxonomies labels translations on Advanced → Code |
| Built-in interface strings: Filter, Reset, Clear All, price range, In stock, Show products filter form | Text domain woocommerce-products-filter | WPML String Translation, Loco Translate or .po/.mo files |
| Title of the filter widget | The WordPress widget | Widget translation of your multilingual plugin |
Most failed attempts translate a text in the wrong place, for example an attribute title in Loco Translate, or a custom label in WPML String Translation, where the plugin never registers it.
Translate WooCommerce product filter labels with Polylang or WPML
Filter titles and every text typed into the plugin settings are translated with one lookup table in the plugin. It works the same for WPML and Polylang; the field appears only when one of them is active.
- Give the block a fixed original. On the Structure tab click the cog (additional options) next to the taxonomy and fill in Taxonomy custom label, for example
Color. Without a custom label the original is the taxonomy name WordPress returns in the current language. For attributes WooCommerce builds it as "Product Color", and a translation plugin may already have changed it, so a line written for one form does not match on another language. - Open Advanced → Code → WPML taxonomies labels translations and add one line per label and language: language, colon, original text, caret, translation.
- Use the right language code. With WPML it is the WPML language code (
fr,de,pt-br). With Polylang it is the locale of the language (fr_FR,en_GB,uk), as shown in the Locale column of Polylang's language list. Usingenon a Polylang site that runsen_GBis the most common reason nothing changes. - Save, then clear the page cache and check the page in the other language.
For a shop in English with French and German, on WPML:
fr:Color^Couleur
fr:Size^Taille
de:Color^Farbe
de:Size^Größe
The same on Polylang:
fr_FR:Color^Couleur
fr_FR:Size^Taille
de_DE:Color^Farbe
de_DE:Size^Größe
The default language needs no lines: without a match, the original is shown.
How the lookup matches
- The original must be the text the block would show without translation: the custom label, or the taxonomy name if there is none. Spaces at the ends and letter case do not matter, and labels in any script work.
- Each line needs the language prefix. A line such as
Containertyp^Container typeis ignored. - The original may contain a colon, but not a caret: the first
^ends it. - It is a table, not a per-field setting. One line translates that text wherever it passes through the filter: the block title, the title in the panel of selected filters, a button or a placeholder.
The same table translates the texts you typed into the settings: Filter button text and Reset button text, the price filter title, placeholders of the text, SKU and author search, the toggle texts, the Show more and Show less texts, tooltips, titles and options of meta and ACF filters, and section titles. Write the line with exactly the text you typed, for example fr:Sort by price^Trier par prix.
One side effect matters for custom CSS: each block also gets a class built from its displayed title, so woof_container_couleur on the French page and woof_container_color on the English one. Style blocks through the class built from the taxonomy slug, such as .woof_container_pa_color, which is the same in every language.
Interface strings: Loco Translate, WPML String Translation and .po files
The plugin's built-in texts are ordinary WordPress strings in the text domain woocommerce-products-filter. Two settings affect them: Filter button text and Reset button text. When those fields are empty, the buttons use the translatable defaults Filter and Reset; once you type your own text, it becomes a settings text and goes into the lookup table above.
WPML. Scan the plugin in WPML → Theme and plugins localization, then translate the strings of the woocommerce-products-filter domain in String Translation.
Loco Translate, also the usual choice with Polylang, whose string list does not include plugin strings:
- Go to Loco Translate → Plugins, open HUSKY and add a new language.
- Choose the Custom or System location, not the plugin's own
languagesfolder. Plugin updates replace that folder, and in 3.4.6 the plugin does not load translation files from it. - Before syncing, open Loco Translate → Settings and raise Skip PHP files larger than to at least 200 KB. The plugin's main file is about 145 KB and holds strings such as Clear All, price range, the sorting names in the selected-filters panel and Show products filter form. With the default limit of 100 KB Loco skips the file, those strings are missing, and a sync removes them from an existing translation.
- Sync, translate, save. Loco compiles the .mo file next to the .po file.
Ready translation files for many languages are on the translations page. Whatever tool you use, the file name must end with your site's exact locale, for example woocommerce-products-filter-de_DE.mo, and the file belongs in wp-content/languages/plugins/ or Loco's custom folder. The FAQ working with WPML has the short version of the table syntax.
Single strings by hook, per language
Some texts are easier to set in code, especially when the same text must differ by language. These hooks exist in 3.4.6:
- woof_filter_title: receives every text that passes through the lookup table, after the table, so it can change any block title, button or placeholder.
- woof_clear_all_text: the Clear All link of the selected-filters panel.
- woof_start_filtering_btn_txt: the Show products filter form button.
woof_ext_custom_title_by_instock,woof_ext_custom_title_by_onsales,woof_ext_custom_title_by_featured,woof_ext_custom_title_by_backorder: labels of the In stock, On sale, Featured and backorder checkboxes.
/*
* Product filter: per-language texts set in code.
* Child theme functions.php or a code snippets plugin.
*/
function my_filter_lang() {
if (function_exists('pll_current_language')) {
return pll_current_language(); // Polylang: language slug, e.g. "fr"
}
return apply_filters('wpml_current_language', null); // WPML: language code
}
add_filter('woof_filter_title', function ($title, $taxonomy_info, $index) {
$texts = array(
'en' => array('Formations' => 'Bands'),
'de' => array('Formations' => 'Besetzungen'),
);
return $texts[my_filter_lang()][$title] ?? $title;
}, 10, 3);
add_filter('woof_clear_all_text', function ($text) {
return my_filter_lang() === 'fr' ? 'Tout effacer' : $text;
});
Note that the language here is the Polylang slug (fr), not the locale used in the lookup table.
Terms, term order and swatches in other languages
The filter prints the terms of the current language that WordPress returns. If a value appears in the original language, the term itself is not translated yet: translate it in WPML (attributes through WooCommerce Multilingual) or in Polylang. If it is translated and still shows the old name, clear the page cache and the plugin's Cache terms with the clear terms cache button on Advanced → Options.
Translated terms are separate terms with their own order. To keep the order of the default language, open the term list (Products → Categories, or Products → Attributes → Configure terms), switch the admin language and arrange the terms again. Colours and images of the Color and Image types need to be set only on the default-language terms: a translated term without its own colour or image uses the one of its original.
Checklist
- Every block that needs a translated title has a Taxonomy custom label, and the lines in WPML taxonomies labels translations repeat that label exactly.
- The language prefix is the WPML language code on WPML and the full locale on Polylang.
- Texts typed into settings fields are in the lookup table; built-in strings are translated in the
woocommerce-products-filterdomain. - Loco files are in the Custom or System location, and the PHP size limit was raised before syncing.
- Custom CSS targets blocks by taxonomy slug, not by title.
- Page cache and terms cache were cleared before testing the second language.
If a label still refuses to change, open a topic on the HUSKY support forum with a link to the page in the second language, the translation plugin you use and the lines you added.