Show different selector text per language #
If you run a multilingual store, the Number of Products per Page – Pagination Manager for WooCommerce plugin can show different label text depending on the active language. Products per Page provides the [alg_wc_ppp_translate] shortcode for this, and it reads the current language from WPML or Polylang.
Before you start #
- WPML or Polylang, active and configured with your languages.
- The selector template you want to translate. This shortcode is used inside the Template field or wherever the selector text appears.
Two ways to use it #
1. Attribute form. Provide the text for the listed languages and a fallback for all others.
[alg_wc_ppp_translate lang="EN,DE" lang_text="Products per page" not_lang_text="Produits par page"]
Here shoppers viewing English or German see “Products per page”, and everyone else sees the fallback text.
2. Enclosing form. Wrap the content, and show or hide it by language. Use lang to target languages, or not_lang to target every language except those listed.
[alg_wc_ppp_translate lang="EN"]Products per page[/alg_wc_ppp_translate][alg_wc_ppp_translate not_lang="EN"]Productos por pagina[/alg_wc_ppp_translate]
Attributes #
| Attribute | Purpose |
|---|---|
lang |
One or more language codes, comma separated (for example EN,DE) |
not_lang |
Enclosing form only: show the content for every language except these |
lang_text |
Attribute form: the text shown for the listed languages |
not_lang_text |
Attribute form: the fallback text for other languages |
Language codes are matched case-insensitively against the active language, so EN and en both match. If no multilingual plugin is active, the current language is treated as unset, so the fallback (not_lang_text, or the not_lang block) is shown.
Using it inside the template #
You can place this shortcode directly in the Template field at WPFactory > Products per Page (also reachable at WooCommerce > Settings > Products per Page), alongside placeholders like %dropdown%. When nesting it inside the [alg_wc_products_per_page] shortcode’s enclosed content, write the nested tag with curly braces ({alg_wc_ppp_translate ...}) so it is not parsed too early.
Get more control #
The translation shortcode is free. Number of Products per Page – Pagination Manager for WooCommerce Pro adds an editable options list and a Products per Page widget. See what Pro unlocks.