Starting with the Weglot WordPress plugin
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 ?
- 1.It creates URL for each languages, like
/es/about/for instance (but doesn't create actual pages in WordPress backend)
- 2.On these URL, it returns the translated content
- 3.It adds a language button on the page and the
hreflangtags in the
<head>section of your page for SEO.
In the settings page, configure the 3 mandatory settings :
- 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-notranslateon 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 -->