• Resolved cris123pp

    (@cris123pp)


    Hello. Thank you for the plugin.
    We have an inconvenient situation. Our default language is Brazilian Portuguese, but at some point when we access the site, it changes to another random language without us selecting another language. Sometimes it changes to Portuguese from Portugal, sometimes to French, there is no default, and this should not happen, since we are only accessing from Brazil at the moment.
    I notice that this has been happening mainly when we use mobile browsing, and even testing in an incognito window this has also been happening. We do not know how to solve this.

    Site: https://www.adamatecidos.com.br/
    Thank you.

    • This topic was modified 11 months ago by cris123pp.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Support Alex

    (@alexcozmoslabs)

    Hi,

    We tested your site on both desktop and mobile (including incognito mode), and in our case, the issue was not reproduced — the site consistently loads in the default language, Brazilian Portuguese, as expected.

    Do you have any Browser Language Detection plugin?
    If not, maybe caching or CDN services (like Cloudflare, LiteSpeed, etc.) might serve cached pages in the wrong language if the language is stored in the URL or cookie.

    Thread Starter cris123pp

    (@cris123pp)

    Thanks for replying. We use wprocket to manage cache and cloudflare cnd.

    Plugin Support Alex

    (@alexcozmoslabs)

    Hi,

    We did not encoutner the issue on your website, so we assume it’s working fine now.
    If you will encounter the behaviour again, check/clear your cache system.

    Best Regards,

    • This reply was modified 11 months ago by Alex.
    Thread Starter cris123pp

    (@cris123pp)

    Hello. The problem actually still persists. If it could be a conflict with the cache and the CDN, is there anything that can be done?

    Plugin Support Alex

    (@alexcozmoslabs)

    Hi,

    Do you use for some reason the Automatic User Language Detection Add-On from us?

    Thread Starter cris123pp

    (@cris123pp)

    It is not in use. For some reason it seems to have stabilized after I removed some transients. I will monitor it to see if it remains stable.

    Thanks.

    Thread Starter cris123pp

    (@cris123pp)

    Hello again. When I thought it was stable, it was just clearing the cache. As soon as the cache is full, the language on the mobile device appears in any random way, and only after clearing the entire cache does the default language appear.

    Can’t you help us with this?

    Thank you.

    Plugin Support Alex

    (@alexcozmoslabs)

    What you’re experiencing sounds like a caching-related issue, which can occur when full-page cache systems (from plugins, hosting, or CDNs like Cloudflare or LiteSpeed) serve the wrong cached version of a page — often in the wrong language — to users.

    Since TranslatePress stores the selected language in a cookie (not in the URL, unless you’re using the subdirectory or subdomain URL structure), the caching system might not be varying the cache based on that cookie, leading to pages in different languages being randomly served to users.

    Here’s what we recommend:

    1. Configure cache to vary by language cookie
      If you’re using any caching plugin or server-level caching, make sure it’s set to vary or exclude cache based on the trp_language cookie. This ensures each language version gets its own cached version.
    2. Mobile caching
      Some caching tools treat mobile and desktop differently. Make sure your cache doesn’t combine mobile and desktop content or incorrectly serve one to the other.
    3. CDNs or server-side caching
      Make sure these are also set up to vary by cookie or exclude language-based pages from aggressive caching. With Cloudflare, for example, you can create a Page Rule or Cache Rule to bypass caching for trp_language-dependent pages.

      We understand this can be frustrating, especially when it appears to work after clearing the cache. That’s a strong indicator the caching layer is not differentiating between language versions correctly.
    Thread Starter cris123pp

    (@cris123pp)

    Thanks for replying. The rule to be created in cloudflare to ignore the cache for trp_language, would be for which type of field? See the example I made in the image to see if it would be correct please.

    https://www.adamatecidos.com.br/wp-content/uploads/2025/06/print.png

    • This reply was modified 10 months, 3 weeks ago by cris123pp.
    Plugin Support Alex

    (@alexcozmoslabs)

    Hi,

    In Cloudflare, the ideal setup is to create a Cache Rule that bypasses cache when the trp_language cookie is present.
    The attached link is not accessible from what’ve checked.

    Please note that we’re not Cloudflare specialists, so this is just a general recommendation:

    1. Go to Rules > Cache Rules in your Cloudflare dashboard.
    2. Create a new rule with:
      • Field: Cookie
      • Operator: contains
      • Value: trp_language=
    3. Choose Bypass cache.

    They may have other settings. Feel free to reach their support for more details.

    Thread Starter cris123pp

    (@cris123pp)

    obrigado

    Plugin Support Alex

    (@alexcozmoslabs)

    You are welcome.

    Kind Regards,

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Change of language’ is closed to new replies.