• Hi everyone,

    I’ve hit a wall with a project I’m on. I’m using the “locale” filter to allow the user to pick between English and Russian on the front end of the website. The switch of language shows different menus and content. This is controlled via a cookie and the $_GET superglobal. This is working fine.

    I’m not turning my attention to Googlebot, wondering how I can automatically show a page with Russian content with the locale set to Russian. I’ve tried many ideas, but the main issue is, I can’t seem to find a way to access the $post variable until after the locale filter has been used 2 times. The first 2 times I can’t use conditionals like is_single() or get post meta, which is what I need.

    Is it possible to have information about the post/page and hook before the locale is set the first time? Translated strings using __() and _e() are outputting in English before I have a change to switch to Russian!

    Thanks for reading…

Viewing 1 replies (of 1 total)
  • Just a suggestion. Capture the output and hold the initial text using ob_start() … ob_get_clean() functions. Possibly capture the two phrases separately. Then after you can test the locale, you have the choice of replacing the English text, then you output this delayed text.

Viewing 1 replies (of 1 total)
  • The topic ‘Switch locale as soon as possible’ is closed to new replies.