• Resolved manuelpette

    (@manuelpette)


    Hi,

    first I’d like to thank you for the great plugin!
    It worked great so far but I am having issues with multilanguage management. I built an app on top of a WP website that uses QTranslate X to manage multilanguage content. If the content gets cached in the main language and then I change language, the content returned from following requests is still in the main language. Endpoints structure is the basic WP [domain]/wp-json/wp/v2/[post_type] and when its not in the main language its: [domain]/[LANGCODE]/wp-json/wp/v2/[post_type].
    I tried to add the language=[LANGCODE] parameter to the call too but nothing changes, response is still in the cached language.

    Thanks in advance for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Acato

    (@acato)

    Hi @manuelpette

    Thank you for using our plugin!

    We use MultilingualPress for multilanguage websites (which has it’s own subsite for each language and thus the caching is per subsite), so I do not have any experience with qTranslate X. So unfortunately at this point I do not have an answer to your question and will first have to investigate this.

    However: adding the language=[LANGCODE] as a parameter to the call should solve the issue, since a call to /wp-json/wp/v2/[post_type] should result in a different cache being created than a call to /wp-json/wp/v2/[post_type]?language=[LANGCODE]. So I am a little puzzled as to why both return the cached language. Could you check if indeed two seperate caches are created? You can check by visiting Settings > WP REST Cache > Tab: Endpoint API Caches

    Thread Starter manuelpette

    (@manuelpette)

    Hi @acato!

    Thanks for getting back to me! I solved the issue this way (for anyone who might end up here with the same problem): I built custom rest api endpoints returning only the information i needed (to improve performance even further) registered them to be cached as per your FAQ section ‘Can I register my own endpoint for caching?’. This way for some reason the cache actually recognizes the language=[LANGCODE] parameter as a totally different endpoint. Since the code is now working I didn’t investigate the previous issue further but it might have been there because of some qTranslateX intervention (I am not a fan of this multilingual plugin ?? ).
    Thanks for getting back to me anyway and congrats for the great plugin!

    Keep up the good work!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Caching through languages’ is closed to new replies.