I was not far when i tried alone but not enough near. :D
I tried to debug the code for 3 hours, like a dumb, because the server gave to me "internal server error 500 ".
Also if loggin was active, wordpress and server too weren't new log.
Anyway i found the problem and fixed it. Thanks you so much Chouby. ^^
add_filter('pll_get_strings', 'add_widget_text');
function add_widget_text($strings) {
global $wp_registered_widgets;
$sidebars = wp_get_sidebars_widgets();
foreach ($sidebars as $sidebar => $widgets) {
if ($sidebar == 'wp_inactive_widgets' || !isset($widgets))
continue;
foreach ($widgets as $widget) {
if (!isset($wp_registered_widgets[$widget]['callback'][0]) || !is_object($wp_registered_widgets[$widget]['callback'][0]) || !method_exists($wp_registered_widgets[$widget]['callback'][0], 'get_settings'))
continue;
$widget_settings = $wp_registered_widgets[$widget]['callback'][0]->get_settings();
$number = $wp_registered_widgets[$widget]['params'][0]['number'];
if (isset($widget_settings[$number]['text']) && $text = $widget_settings[$number]['text'])
$strings[] = array('name' => 'Widget text', 'string' => $text, 'context' => 'Widget', 'multiline' => true);
}
}
return $strings;
}
add_filter instead of add_filters
And i added the names to the array keys.
They are added at the end of the pages but whocares. ^^
Update:
If i edit the text the query works but in the frontend the widget remain with the "default" language.
I think that the problem is the widget option "The widget is displayed for: All languages" that if turned ON override the visualization of the translation and if it's turned OFF hide the widget for the other language.