Antes de pasar por el plugin 

[lang='es']hola[/lang ]
[lang='en']hello[/lang ]
generico
[lang='es']adios[/lang ]
[lang='en']bye[/lang ]

Después de pasar por el plugin 

hola

generico

adios

 

ML.php 

<?php
add_filter('mce_buttons', 'ML_mce_buttons');
 
function ML_mce_buttons($buttons) {
   array_push($buttons, "separator", "ML_en_bt", "ML_es_bt");
   return $buttons;
}
 
add_filter("mce_external_plugins", "ML_mce_external_plugins");
 
function ML_mce_external_plugins($plugin_array) {
   $plugin_array['ML'] = '/wp-content/plugins/ML/ml.js';
   return $plugin_array;
}
 
/****************/
 
add_filter('query_vars', 'ML_query_vars');
 
function ML_query_vars($qvars){
	$qvars[] = 'lang';
	return($qvars);
}
 
/****************/
 
add_filter('the_content', 'filtro');
 
$debug="";
 
function filtro($text) {
	global $current_user, $wp_query , $post, $lang, $debug;
 
	//solo funciona en la pagina de prueba.
	if($post->post_name!='test') return $text;	
 
	$debug.=var_export($wp_query->query_vars,true);
 
	//esto no es necesario, WP ya te crea la variable lang de forma global.
	//$lang=$wp_query->query_vars['lang'];
 
	// si no hay lang definido lo ponemos por defecto a ES
	if(empty($lang)) $lang="es";
 
	preg_match_all("|\[lang='(.*)'\]|",$text,$salida);
	$idomas=array_unique($salida[1]);
 
	$bar="<div>";
	foreach ($idomas as $i) {
		if($i!=$lang) $bar.="<a href='". get_permalink($post->ID) ."?lang={$i}'>";
		$bar.="<img src='/wp-content/plugins/ML/flags/{$i}.png'/>";
		if($i!=$lang) $bar.="</a>";
	}
	$bar.="</div>";
	$text=$bar.$text;
 
	$text=preg_replace_callback("|\[lang='(.*)'\](.*)\[/lang\]|","replace",$text);
 
	if($current_user->ID==1) {
		$debug.=var_export($post,true);
		//$text.="<pre>({$current_user->ID})({$lang})({$_SERVER['REDIRECT_URL']})\ndebug=$debug</pre>";
	}
 
	return($text);
}
 
function replace($matchs){
	global $lang,$debug;
 
	$debug.="($lang)".var_export($matchs,true)."\n";
 
	$res="";
	if($matchs[1]==$lang) $res=$matchs[2];
	return $res;
}
 
?>

ml.js

(function() {
  var DOM = tinymce.DOM;
  tinymce.create('tinymce.plugins.ML', {
    init : function(ed, url) {
      ed.addCommand('ML_apply', function(ui, value) {
        ed.execCommand('mceReplaceContent', 0, "[lang='"+value+"']{$selection}[/lang]");
      });
      ed.addButton('ML_en_bt', {
        title : 'Ingles',
        image : url + '/flags/en.png',
        cmd : 'ML_apply',
        value:'en'
      });
      ed.addButton('ML_es_bt', {
        title : 'Espa–ol',
        image : url + '/flags/es.png',
        cmd : 'ML_apply',
        value:'es'
      });
    },
    getInfo : function() {
      return {
        longname : 'ML Plugin',
        author : 'laullon',
        authorurl : 'http://wordpress.org',
        infourl : 'http://wordpress.org',
        version : '0'
      };
    }
  });
  tinymce.PluginManager.add('ML', tinymce.plugins.ML);
})();