URL parameter change language not working in WordPress 4.0
-
Hello,
We were using Fast Secure Contact Form with qtranslate in WordPress 3.6 previously, it was working fine to display correct language in the contact form (by detecting URL). (e.g. “Comments or questions are welcome” becomes “歡迎批評指教” for Chinese)
Recently we installed WordPress 4.0 and Fast Secure Contact Form 4.0.30, it seems the URL detecting is not working any more which suppose to be working (https://www.fastsecurecontactform.com/translate-php , no matter /tw/ or ?lang=tw).
I found that si-contact-form is using function load_plugin_textdomain to load the lanugage in class-fscf-util.php, hence I added below code to display what locale and mofile it got, now I supprise that it is “en_US” for si-contact-form while other plugins load correctly.
wp-includes/l10n.php
function load_plugin_textdomain( $domain, $deprecated = false, $plugin_rel_path = false ) { $locale = get_locale(); /** * Filter a plugin's locale. * * @since 3.0.0 * * @param string $locale The plugin's current locale. * @param string $domain Text domain. Unique identifier for retrieving translated strings. */ $locale = apply_filters( 'plugin_locale', $locale, $domain ); if ( false !== $plugin_rel_path ) { $path = WP_PLUGIN_DIR . '/' . trim( $plugin_rel_path, '/' ); } else if ( false !== $deprecated ) { _deprecated_argument( __FUNCTION__, '2.7' ); $path = ABSPATH . trim( $deprecated, '/' ); } else { $path = WP_PLUGIN_DIR; } // Load the textdomain according to the plugin first $mofile = $domain . '-' . $locale . '.mo'; ob_start(); echo "<BR><BR>-----------------------------------------<BR>\r\n"; echo $locale . " : " . $mofile . "<BR>\r\n"; return $loaded; // Otherwise, load from the languages directory $mofile = WP_LANG_DIR . '/plugins/' . $mofile; return load_textdomain( $domain, $mofile ); }
Here is the demo site to show the problem:
https://t.nethub.com.hk/tmp/webeasy/tw/contact-us/
- The topic ‘URL parameter change language not working in WordPress 4.0’ is closed to new replies.