Ok I did otherwise, but it’s no more with GUI… the main interest of mini loops.
To achieve a translation of a mini loop and the strings inside items format, I used WPML, Executable PHP widget and the shortcode of mini loop.
First of all, you should try your loop with mini loop. In this way, you will be aware of what option to add to the shortcode and be sure the loop works.
Use the executable PHP widget to create a widget in which you can write some PHP. You need it to invoke the WPML conditional tags.
And there’s the result :
<?php
if (ICL_LANGUAGE_CODE == 'fr') {
echo '<div>'; // this is what I usually put in the "before items" section of mini loop
echo do_shortcode('[miniloop categories=46 number_posts=1 shuffle_order=1 order_by="random"]{image from=attached width=70 height=auto cache=clear}<h4><a href="{url}" title="En savoir plus sur le projet de {title}">{title}</a></h4><p>{excerpt custom=1}</p>[/miniloop]');
echo '</div><div class="more"><a href="/clients" title="Tous nos clients"><span>Tous nos clients</span></a></div>'; // this is what I usually put in the "after items" section of mini loop
}
elseif (ICL_LANGUAGE_CODE=='en') {
echo '<div class="widget-content client">';
echo do_shortcode('[miniloop categories=46 number_posts=1 shuffle_order=1 order_by="random"]{image from=attached width=70 height=auto cache=clear}<h4><a href="{url}" title="Read more about the project of {title}">{title}</a></h4><p>{excerpt custom=1}</p>[/miniloop]');
echo '</div><div class="more"><a href="/clients-2" title="More clients"><span>More clients</span></a></div>';
}
else {}
?>
And there’s a list of the arguments supported by the shortcode :
$args = array(
'title' => __( 'Recent Posts', 'mini-loops' ),
'hide_title' => 0,
'title_url' => '',
'number_posts' => 3,
'post_offset' => 0,
'post_type' => 'post',
'post_status' => 'publish',
'order_by' => 'date',
'order' => 'DESC',
'reverse_order' => 0,
'shuffle_order' => 0,
'ignore_sticky' => 1,
'only_sticky' => 0,
'exclude_current' => 1,
'categories' => '',
'tags' => '',
'tax' => '',
'custom_fields' => '',
'exclude' => '',
'before_items' => '<ul>',
'item_format' => '<li><a href="[url]">[title]</a><br />[excerpt]</li>',
'after_items' => '</ul>',
);
Of course, I could have put the code before and after inside the shortcode… but It’s outside for readability and to bulletproof the shortcode with less arguments.
Glad if it could help. But the ability to have gettext expressions inside the items format (before and after too) would be a great feature…