Weglot has built a powerful WordPress plugin that integrates in your WordPress website and make it multilingual in a few minutes.
What does Weglot plugin do exactly ?
It creates URL for each languages, like
/es/about/ for instance (but doesn't create actual pages in WordPress backend)
On these URL, it returns the translated content
It adds a language button on the page and the
hreflang tags in the
<head> section of your page for SEO.
To start, install Weglot Translate plugin directly from the directory.
In the settings page, configure the 3 mandatory settings :
API Key : You get an API key in your account. If you don't have one, you can create your account.
Original Language : The original language of your WordPress website.
Destination Languages : The languages you want your website to be translated into.
Save the settings and you are done. You will see the language button appear on your website.
By default, all pages are translated. You can use this field to enter URL that you don't want to translate. This field is flexible, you can exclude exact URL, or URL that contains some words or matches some regex
Another example, if you want to only translate your homepage, meaning you want to exclude every URL except
/ , you would use the "Match regex" and enter the following :
By default, everything is translated inside a page. But sometimes, you don't want to translate part of your page. For example all product descriptions or a customer review area.
You can add any CSS selector in the field "Exclude blocks" and it will add an attribute
data-wg-notranslate on this HTML element. Everything inside this element won't be translated.
For example, if you enter this :
.product-description , then your translated page will be :
<h1 class="product-title">Mon super article</h1> <!--The title is being translated--><p class="product-description" data-wg-notranslate>My awesome article</p><!--The description is not being translated because you excluded class product-description -->