I get search results in wrong language. My browser have language A set (main lang of WPML). But when i use google on language A domain and se result it shows my page as first. Main text is in language B, not A as it should be. But the under pages also shown in google result under the main text is correctly in language A.
How do i fix this?
Welcome to the WPML support forum. We don't have any control on Google results however there are two settings in WPML that can affect your site's SEO so let's start here:
1 - The use of "language as parameter" (?lang=en), this is not the case here since you are using directories (/es). But many you change that option recently?
Ref: hidden link
I recommend disabling this option (if it's enabled) and then resubmit your sitemap to Google Console and wait for Google to reindex your site. Note that disabling the option will not have an immediate impact. Google will need to crawl your site again and properly re-index it (we have no influence on this process).
Also, make sure you don't have any third party plugin that would create such kind of automatic redirection based on browser language or geo-localization.
PS: Regarding your Google search - Google personalizes search results more and more. There are many factors that go into Google's algorithm such as your geolocation, your browsing history, browser's language, etc. When you perform those tests, try from another browser and/or in incognito mode, and if possible use a VPN to change your geolocation.