Different images and content per language
Not everything should be the same in every language. With WP Provider Translate you can show a different image, video, audio file, embed or document per language, show a block or section only in some languages, and decide which parts of your site exist in which language with address rules. Your original page stays the same; the differences apply only in the languages you choose.
A different image, video or PDF per language
Text inside an image, a video or a PDF is not translated. Instead, choose a replacement file for a language. It is used wherever that file appears in that language, on every page; the other languages keep the original.
On the page:
- Open the page in the language you want, and click Edit translations in the admin bar.
- Click the image, video or background. For files you cannot click, such as a PDF behind a link, the share image or an embed, click All media in the editing bar.
- Click Choose from media library and pick the file, then Use this file. Or paste a web address under Or paste an address and click Use this address. For an embed, such as a YouTube video, paste the address of the video in that language.
- Use original puts the original file back.
On the Translations screen:
- Go to WP Provider Translate → Translations, pick the language tab and choose the page on the left.
- Open the Media section above the texts (“replace an image, video or document”). It lists the share image and every image, video, audio file, embed and document on the page.
- Click Choose replacement, or paste an address and click Use address.
Clicking works also for images inside a zoom, slider or lightbox. Every size WordPress made of an image is replaced, so responsive images show the replacement too.
Show a block only in some languages
For content that belongs to one country, such as a phone number, a price note or legal text, show it only in the languages where it applies.
In the block editor:
- Select the block.
- In the block settings on the right, open Languages.
- Tick the languages the block should appear in. With none ticked, it appears in all languages.
- Save the page.
In other languages the block is removed before the page is sent, so it is never shown, translated or sent for translation.
In Elementor: select the element, go to the Advanced tab, open Languages and choose the languages under Show in. Empty means all languages.
The language shortcode
In the classic editor, text widgets and page builders, wrap content in the [wpprovider_lang] shortcode:
[wpprovider_lang only="fr,de"]…[/wpprovider_lang]shows the content only in French and German.[wpprovider_lang hide="en"]…[/wpprovider_lang]shows it in every language except English.
Use the language codes as shown in your language list, such as /es/ for Spanish. Like the block setting, the content is removed in the other languages before the page is sent.
CSS classes for page builders
Page builders with a CSS class field can use classes on any element:
wpprovider-only-frshows the element only in French. Severalwpprovider-only-classes on one element show it in any of those languages.wpprovider-hide-enhides the element in English.
These classes hide the element with CSS, so it is still in the page and still translated. Use the block setting or the shortcode when content must really be left out.
Address rules: which pages exist in which language
You can set per page which languages it appears in, in the Languages box of the editor; see How translation runs. For many pages at once, use address rules.
- In WordPress, go to WP Provider Translate → Settings.
- Under Pages per language, click Add rule.
- Choose how to match the address: starts with, is exactly, contains or matches regex, and type the address, for example
/blog/. - Under Only in, tick the languages these pages should exist in.
- Click Save Changes.
For example, “starts with /blog/, only in NL and EN” keeps your blog out of every other language.
- The first matching rule counts. Put the most specific rules at the top.
- A page’s own Languages setting wins over any rule.
- In other languages the page is left out of the language switcher, menus and the sitemap, and its address leads to that language’s home page.
The language switcher also only lists the languages a page exists in; see Language switcher options.
Troubleshooting
- The replacement image does not show. Check that you replaced it in the right language: a replacement applies to one language only. If you use a caching plugin, clear its cache; see Caching plugins.
- A section I limited to one language still shows elsewhere. A class only hides with CSS; check the class name and the language code. With the block setting, check that the right languages are ticked and the page is saved.
- An address rule has no effect. A page’s own Languages setting wins over rules, and only the first matching rule counts. A rule without any language ticked is not saved.
- A page leads to the home page in one language. It is not available in that language, by its own setting or by a rule.