thanks for the help, I used javascript to solve this problem, in this code I used the jquery framework and it works only for the Arabic language, for other languages you have to change the comparison value charCodeAt (0).
$('#input_ar').keyup(function(){ if ((($(this).val().charCodeAt(0) > 0x600) && ($(this).val().charCodeAt(0) < 0x6FF)) || ($(this).val()=="")) { $('#search_input').css("direction","rtl"); } else { $('#search_input').css("direction","ltr"); } });
source share