I add a question here, because I noted that multipress did not change teh WP_LANG constant on any of the blogs, even though I set the language correctly in the “network admin”.
Any help is highly appreciated.
I have tried get_locale, and I am still only getting en_US always
echo ‘local:>>’;
var_dump(get_locale());
exit;
I have done this, but still not helping :
if (!function_exists(‘mq_load_theme_translation’)) {
function mq_load_theme_translation() {
// Retrieve the directory for the localization files
$lang_dir = WP_LANG_DIR . ‘/’ . get_locale() . ‘/sunjoytravel’;
// Set the theme’s text domain using the unique identifier from above
load_theme_textdomain(‘sunjoytravel’, $lang_dir);
}
// end custom_theme_setup
}
add_action(‘after_setup_theme’, ‘mq_load_theme_translation’);
I found this snippet in source code :
if ( ” != $data[ ‘inpsyde_multilingual_lang’ ] || ” != $data[ ‘inpsyde_multilingual’ ] ) {
if ( ! is_array( $siteoption ) )
$siteoption = array( );
$siteoption[ $current_blog_id ] = array(
‘text’ => esc_attr( $data[ ‘inpsyde_multilingual_text’ ] ),
‘lang’ => esc_attr( $data[ ‘inpsyde_multilingual_lang’ ] )
);
}
update_site_option( ‘inpsyde_multilingual’, $siteoption );
Will it help to use this value to get the current locale? blog language?
Is this any close? $result = $wpdb->update( $wpdb->sitemeta, array( ‘meta_value’ => $value ), array( ‘site_id’ => $wpdb->siteid, ‘meta_key’ => $option ) );
By the way, I want the most standard and clean way.
I used this, and it worked to load the text domain, but it is still not solving the main problem which is that for example the plugin did not set the language automatically and loaded rtl.css in case of Arabic.
$locale = get_site_option(‘inpsyde_multilingual’);
var_dump($locale[get_current_blog_id()]);
I have been going through the source code of the WordPress :
You see, even though I enforced the blog locale as mentioned above, it gets overriden here :
function load_theme_textdomain( $domain, $path = false ) {
$locale = apply_filters( 'theme_locale', get_locale(), $domain );
if ( ! $path )
$path = get_template_directory();
// Load the textdomain from the Theme provided location, or theme directory first
$mofile = "{$path}/{$locale}.mo";
if ( $loaded = load_textdomain($domain, $mofile) )
return $loaded;
// Else, load textdomain from the Language directory
$mofile = WP_LANG_DIR . "/themes/{$domain}-{$locale}.mo";
return load_textdomain($domain, $mofile);
}
The locale is still not popularized with multipress locale or wplang or which is used to do the job?