I am looking to add translation to my select2 dropdowns, I have the following: View
<%= f.collection_select(:guest_id, User.all, :id, :full_name, {}, class: "selectpicker", placeholder: true, multiple: true) %>
<SCRIPT> $(document).ready(function () {
$('#invitation_guest_id').select2({
language: $('html').attr('lang'),
placeholder: I18n.t('js.posts.select2.contact_name_dist'),
minimumInputLength: 3
});
});
</SCRIPT>
I have a file Translation.js
with the key contact_name_dist
translated in many languages. For some reason, Rails only returns the english translation. Good thing, is it means it can read my file. But probably not picking up the language instruction. Any argument missing ?
Aucun commentaire:
Enregistrer un commentaire