Rails 3 change default english numbers to arabic numbers
问题 I want to change the default numbers from english to arabic when the user switches to the arabic interface. 13 => ١٣ 89 => ٨٩ What is the best way to tackle this problem? 回答1: I add in helper module ARABIC_NUMBERS = %w(٠ ١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩) def ta numbers numbers = numbers.to_s if numbers.is_a? Integer results = numbers.chars.map { |char| ARABIC_NUMBERS[char.to_i] }.join end 回答2: Check this code : https://github.com/gdotdesign/rails-arabic-convert/blob/master/app/helpers/convert_helper.rb. It