[Resolved] Using localization in iframes
I’ve got a problems while trying to use gettext inside iframes. I’m linking to PHP pages (which has included the WordPress header) and using the gettext function to get those pages to translate. Unfortunately, it keeps using the default language even if I specify the locale.
I’d like any help which could help me fix the localization of those pages. I want to use the same .MO/.PO that my theme use.
So, I have my language files as
theme_name\en_US.poand my iframe files in
Those forms have
<?php include("../../../../wp-blog-header.php"); ?>and
$locale = ($_GET['lang'] == 'fr') ? 'fr_CA' : 'en_US'; define('WPLANG', $locale); setlocale(LC_ALL, $locale);. I tried forcing the locale however the setlocale and define does nothing and it keeps showing me the default language text. I know it’s loading cause the text is not the same, even in the default language. I just can’t seem to figure out how to force a language in a file outside the WordPress theme files.
Bit more code:
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <?php include("../../../../wp-blog-header.php"); ?> <?php $locale = ($_GET['lang'] == 'fr') ? 'fr_CA' : 'en_US'; load_theme_textdomain('theme', get_template_directory()); define('WPLANG', $locale); setlocale(LC_ALL, $locale); ?> <title><?php bloginfo('name'); ?> - <?php _e('theme', 'Test Form') ?></title> [...]
The default language is fr_CA. Any help on this issue would be greatly appreciated!
P.S. Couldn’t post to the WP-Advanced forum so I posted here instead.
- The topic ‘[Resolved] Using localization in iframes’ is closed to new replies.