Add different language option to the web
-
I want to have my web both in English and Spanish so I want to add in the top right corner a button to switch between Spanish or English.
I can’t find a way to do this. ¿Anyone can tell me a way to do this? ¿How to have the web in two languages and have the option to switch from one to other? -
Dear @mauellano
Commonly one would use a language translate plugin to do this,
Recommended and used by Lay Theme users are:Polylang:
https://polylang.pro/And Q-translate XT:
https://github.com/qtranslate/qtranslate-xtHere on the Lay Theme Website we have some documentation on this:
https://laytheme.com/documentation.html#multilanguageHope this helps and best wishes! :)
Richard
-
I have the texts translated to two languages (english and spanish). But I just want to do have a switch button in the top right torner to switch from English to Spanish (for international clients) . So what you recommend me to do for having the web like this? I dont want a translator. Just a duplicate of the web in a second language in the top right corner
-
Dear @mauellano
That a tricky one,
Its dependent on the Permalink structure of your pages, normally the way a language plugin works:You set a 'home' language - it our case english so we reach a page with the permalink :
However a language plugin will create a duplicate of each page and assign a language code to the permalink, so:
The language switch button makes all links clicked to have this /nl/ ( dutch ) placed in front of the standard permalink redirecting it to the correct language.
So my thoughts are you first need all the pages of a particular language to have a 'language code'.
Then you need a piece of jQuery, JS code added that first knows that your language button has been selected - probably via a simple cookie setup
Then if the browser knows that the button is pressed, it makes a links that are clicked to have your language code place into the permalink - redirecting you.
Its a tricky one but here are some references if they help you:
https://stackoverflow.com/questions/1458724/how-do-i-set-unset-a-cookie-with-jquery
https://stackoverflow.com/questions/20475504/onclick-change-url-using-jquery
There is possibly a simpler option which is literally having two different website with the same domain - ( one being a subdomain )
Your main website is standard, then you create a subdomain e.g
( you can create a subdomain with your domain/hosting provider )
And the link in the top corner just takes you to a clone of the website but with the different langauge:
https://premium.wpmudev.org/blog/multilingual-wordpress-site-multisite/
This is how i would go about it, if you don't want a plugin - it is the simpler option.
If this seems to complicated a task, you may wish to seek the Aid of a developer as this is an interesting one - there is unfortunately a good reason so many of us rely upon language plugins instead of doing the work manually
I hope this helps & apologies that the answer isn't as simple as may have been hoped
Best wishes and let me know, Have a great day :)
Sincerely
Richard
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login