we are currently developing a plugin which will comprise a plurality of multi language features, whereby there will be an wpmu-admin version, a wp version and also a combined version... it is the combined version, which will comprise said plurality of features...
actually todate we are not sure, if we will make all features available to the public, maybe we will try to share with some of these wpmudev premium plugins...
you can fand the wpmu-admin version below, simply copy the files in the appropriate directories:
<?php
/*
Plugin Name: WPMU-Default-Language
Plugin URI: http://weshalltelyoulater.net/
Description: Creates a blog in a selected language and lets you select the language of the entire site and of individual blogs.
Author: tpd
Version: 0.0.8
Author URI: http://weshalltelyoulater.net/
*/
include (dirname(__FILE__) . '/wpmu/' . basename(__FILE__));
?>
<?php
/*
Plugin Name: WPMU-Default-Language
Plugin URI: http://weshalltelyoulater.net/
Description: Creates a blog in a selected language and lets you select the language of the entire site and of individual blogs.
Author: tpd
Version: 0.0.8
Author URI: http://weshalltelyoulater.net/
*/
load_textdomain('wpmu', ABSPATH . 'wp-content/mu-plugins/wpmu/languages/wpmu_' . WPLANG . '.mo');
function wpmu_language_dict($value) {
$l_dict['bg_BG'] = __('Bulgarian', 'wpml');
$l_dict['cs_CZ'] = __('Czech', 'wpml');
$l_dict['da_DK'] = __('Danish', 'wpml');
$l_dict['de_DE'] = __('German', 'wpml');
$l_dict['en_EN'] = __('English', 'wpml');
$l_dict['es_ES'] = __('Espanol', 'wpml');
$l_dict['fr_FR'] = __('French', 'wpml');
$l_dict['hu_HU'] = __('Hungarian', 'wpml');
$l_dict['it_IT'] = __('Italiano', 'wpml');
$l_dict['jp_JP'] = __('Japanese', 'wpml');
$l_dict['nl_NL'] = __('Netherlands', 'wpml');
$l_dict['pl_PL'] = __('Polish', 'wpml');
$l_dict['pt_PT'] = __('Portuguese', 'wpml');
$l_dict['sr_RS'] = __('Serbian', 'wpml');
$l_dict['sv_SE'] = __('Swedish', 'wpml');
$l_dict['ru_RU'] = __('Russian', 'wpml');
$l_dict['ua_UA'] = __('Ukranian', 'wpml');
$l_dict['00_00'] = __('not specified', 'wpml');
if ($l_dict[$value] == '') {
return $value;
} else {
return $l_dict[$value];
}
}
function wpmu_language_select($wpmu_lang) {
$dir = ABSPATH . 'wp-content/languages/';
$verz=opendir($dir);
$ext = '.mo';
$i = 0;
$lang_array = array();
while($file = readdir($verz)){
if($file != '.' && $file != '..' && (substr($file, -3)) == $ext) {
$lang_array[$i] = substr($file, 0, 5);
$i++;
}
}
closedir($verz);
$lang_array[$i] = 'en_EN';
asort($lang_array);
foreach ( $lang_array as $key => $value )
{
if ($value == $wpmu_lang) {
$output .= "<option selected value=\"" . $value . "\">" . wpmu_language_dict($value) . "</option>";
} else {
$output .= "<option value=\"" . $value . "\">" . wpmu_language_dict($value) . "</option>";
}
}
echo $output;
}
////////////
function wpmu_language_pre_select() {
if(isset($_POST['wpmu_lang'])) {
$wpmu_lang = $_POST['wpmu_lang'];
} else {
$wpmu_lang = get_option('WPLANG');
}
?>
<label for="wpmu_lang"><span class="prefix_address"><?php _e('Language', 'wpmu')?></span></label>
<?php
wpml_wpmu_signup_extra_fields($wpmu_lang);
}
////////////////////////////////////
function wpml_wpmu_site_language($wpmu_site_lang)
{
?>
<select style="font-size: 18px; border: 1px solid #e5e5e5; font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif; color: #333;" name="wpmu_site_lang">
<?php
$wpmu_lang = $wpmu_site_lang;
wpmu_language_select($wpmu_lang);
?>
</select>
<?php
}
////////////////////////////////////
function wpml_wpmu_language($wpmu_lang)
{
?>
<select style="font-size: 18px; border: 1px solid #e5e5e5; font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif; color: #333;" name="wpmu_lang">
<?php
wpmu_language_select($wpmu_lang);
?>
</select>
<?php
}
//////////////////////////////////
function wpml_wpmu_signup_extra_fields($wpmu_lang)
{
?>
<select style="
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
-webkit-border-radius: 4px;
background: #fbfbfb; font-size: 18px; border: 1px solid #e5e5e5; font-family: 'Lucida Grande', Verdana, Arial, 'Bitstream Vera Sans', sans-serif; color: #333;" name="wpmu_lang">
<?php
wpmu_language_select($wpmu_lang);
?>
</select>
<?php
}
function wpml_wpmu_signup_blog_init($content)
{
if(isset($_POST['wpmu_lang'])) {
$content['wpmu_lang'] = $_POST['wpmu_lang'];
return $content;
}
}
function wpml_wpmu_add_signup_meta($meta)
{
if(isset($_POST['wpmu_lang'])) {
$meta['WPLANG'] = $_POST['wpmu_lang'];
return $meta;
}
}
function wpml_wpmu_manage_page() {
if ('wpmu_process' == $_POST['wpmu_stage'])
{
if(isset($_POST['wpmu_lang']))
update_option('WPLANG', $_POST['wpmu_lang']);
if(isset($_POST['wpmu_site_lang']))
update_site_option('WPLANG', $_POST['wpmu_site_lang']);
}
$wpmu_site_lang = get_site_option('WPLANG');
$wpmu_lang = get_option('WPLANG');
echo "<div class='wrap'><h2>" . __( 'Language Setting', 'wpmu' ) . "</h2>";
echo '<h3>' . __( 'Site Admin Configuration', 'wpmu' ) . '</h3>';
echo '<form method="POST">';
echo '<input type="hidden" name="wpmu_stage" value="wpmu_process" />';
if( is_site_admin() ) {
echo "<p>" . __( 'As a site admin on this site you can set the language of your entire site.', 'wpmu' ) . "</p>";
wpml_wpmu_site_language($wpmu_site_lang);
}
echo "
";
echo "<p>" . __( 'As a blog admin you can set the language of your site.', 'wpmu' ) . "</p>";
wpml_wpmu_language($wpmu_lang);
echo "<p class='submit'><input type='submit' value='" . __( 'Update', 'wpmu' ) . " »' /></p>";
echo "</form>
";
echo "</div>";
?>
<div class='wrap'><h2><?php _e('Comments', 'wpmu') ?></h2>
<fieldset class="options">
<table width="100%" cellpadding="5" class="editform">
<tr valign="top">
<td>
<?php _e('Install, activate, have fun... be happy!', 'wpmu') ?></td>
</tr>
<tr valign="top">
<td>
<?php _e('For further information please visit the Plugin Author', 'wpmu') ?> ... </td>
</tr>
</table>
</fieldset>
<p class="submit">
</p>
</div>
<?php
}
function wpml_wpmu_add_pages() {
$menu = __('Language', 'wpmu');
if( is_site_admin() ) {
$submenu = __('Language settings', 'wpmu');
$option_file = basename(dirname(__FILE__)) . '/' . basename(__FILE__);
add_submenu_page('wpmu-admin.php', 'Language', $menu, 0, $option_file, 'wpml_wpmu_manage_page');
}
else {
$submenu = __('Language options', 'wpmu');
add_management_page($menu, $submenu, 'manage_options', 'languagesettings', 'wpml_wpmu_manage_page');
}
}
add_action('admin_menu', 'wpml_wpmu_add_pages');
add_filter('signup_blog_init', 'wpml_wpmu_signup_blog_init');
// add_filter('signup_another_blog_init', 'wpml_wpmu_signup_blog_init');
add_action('signup_extra_fields', 'wpmu_language_pre_select');
add_action('signup_blogform', 'wpmu_language_pre_select');
add_filter('add_signup_meta', 'wpml_wpmu_add_signup_meta');
?>
Install, use, enjoy... be happy!