Hi i been trying to achieve this. Need to transform all the numbers 1,2,3,4,5 (or 1956,1986 etc) to arabic numbers ١،٢،٣،٤،٥،٦،٧،٨،٩ I achieved this on a test like this
I have to use the value as >1< so the value="1" wont be affected, cause in db i need to store this as 1, not ١
So, before this the same code using just 1 as value, works great, replace everynumber for its similar in arabic , but also in value="" so this screw all the app. cause in other pages when i get the info i get ١ instead of 1
<script>
$(document).ready(function() {
$("select").html(String($('select').html()).replace(/>1</g, '>١<'));
$("select").html(String($('select').html()).replace(/>2</g, '>٢<'));
$("select").html(String($('select').html()).replace(/>3</g, '>٣<'));
$("select").html(String($('select').html()).replace(/>4</g, '>٤<'));
$("select").html(String($('select').html()).replace(/>5</g, '>٥<'));
$("select").html(String($('select').html()).replace(/>6</g, '>٦<'));
$("select").html(String($('select').html()).replace(/>7</g, '>٧<'));
$("select").html(String($('select').html()).replace(/>8</g, '>٨<'));
$("select").html(String($('select').html()).replace(/>9</g, '>٩<'));
});
</script>
Does anyone has an idea, to make this happend in all body (not just selects) and also without altering the value="" numbers, on inputs, selects, or checks, or radio buttons,
thanks!
Ok just to clarify why i need to do this way.. Im using Rails
Im also using i18n but i couldn´t find a way to "translate" numbers
<div id="altura">
<%= f.label :height %>
<%= f.select :height, Player::HEIGHT.collect {|h| [ t("generales.#{h}"), h ] } , :include_blank => true %> <%= f.select :height_measure, Player::HEIGHT_MEASURE.collect {|h| [ t("generales.#{h}"), h ] } %>
<%= f.select :inches, Player::INCH.collect {|h| [ t("generales.#{h}"), h ] }, {}, :style => (@player.inches.present? && @player.height_measure == 'pies' ? 'display: inline ' : 'display: none') %>
<%= f.label :inches, :id => 'inch_label', :style => (@player.inches.present? && @player.height_measure == 'pies' ? 'display: inline ' : 'display: none') %>
</div>