Hi all,
I am using select2 in a wordpress plugin.
We have the rest of the plugin localised and translated without any problems. But for some reason the fields the use select2 don’t translate.
I did check the select2 page on Internationalization, and assume I need to translate the value of placeholder
.
This is the html:
<select id="min-age" name="min-age" class="duo" lang="<?php echo $Syb->get_locale_abbr(); ?>">
<option ... ><?php _e( 'Min Age', $Syb->get_plugin_name() ); ?></option>
<option ... ><?php _e( 'Less than a year', $Syb->get_plugin_name() ); ?></option>
</select>
and JS:
$(function() {
...
$('#min-age').select2({
placeholder : 'Min Age',
minimumResultsForSearch : Infinity,
width : '41%'
});
...
});
How would we localise placeholder
in a way that it would be able to reflect the sites current language, i.e. get_locale()
or get_locale_abbr()
.