Automatically change the language when entering a language domain

Hi,

I have the web in the .com domain and it is displayed in Spanish, which is the language with which it is built and I have the flags on the web of Spanish, Catalan and English.

I also have to buy the .cat domain for the Catalan language.

How can I do so that when a user enters the .cat domain, the web automatically changes to the Catalan language.

that is to say
if you enter “mydomain.com” > it is displayed in Spanish

And if you enter through the domain “mydomain.cat” > it will be displayed in Catalan automatically.

Is there any code that I can put to force the Catalan language when entering “mydomain.cat”?

Or maybe the paid version can do it?

I hope I have explained myself well.

Thanks for your help in advance.

Ana

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer