I have a Wordpress site that is in English. However, I need to have a couple of info pages on the site (like http://x.com/Info-Spanish, http://x.com/Info-German, etc) that are displayed in different languages. Not the entire site, just these 2-3 individual pages (so I can't mess with the WPLANG constant in the wp-config file).
All of these info pages are based on the exact same template, so I'd like to use PO/MO files and the built in localization (l10n) features of Wordpress to display the template in the appropriate language.
My code is something like this:
In functions.php:
load_theme_textdomain( 'my_theme_name', get_template_directory().'/languages' );
Template for /Info-Spanish page:
function set_my_locale( $lang ) { return 'en_ES'; }
add_filter( 'locale', 'set_my_locale' );
add_filter( 'theme_locale', 'set_my_locale' );
require('info.php');
And the underlying info.php file (included above):
_e("Here is some important info which will be displayed in the correct language.");
I have used POedit to create the appropriate translation files in the languages/ folder. However, it's not working-- the info always shows in English. What am I doing wrong? Is Wordpress switching locales?
(BTW is there a way to get some debugging info from Wordpress for these steps? I'm not even 100% certain that it's able to find my PO/MO files in my languages/ folder, since there's no feedback on-screen for the internationalization stuff.)