4

I have developed a multi-lingual site with i18n module (7.x-1.13) and everything works as expected.My Drupal version is 7.34.

Recently, my client have asked not to translate the number. The website works in English and Arabic.

To be more specific, when Arabic is chosen, we do not want the numbers to be displayed in Arabic, instead we need to display the same in English. Now, each numbers are translated to Arabic when the language is chosen as Arabic, even the user input.

The default language is Arabic and I haven't installed any modules for translation of numbers.

Any help would be much appreciated.

2 Answers 2

2

You can use PersianTools modules,

Features

This module is going to cover some basic features required for Persian websites.

Fix possible misplaced chars in mixed Persian and English texts
Find a way to fix Calendar.
Convert English numbers to Persian numbers.
Fix sort issues for persian characters.

One of its features is Convert English numbers to Persian numbers. ( indeed Persian number is Arabic digits ).

Install this module and go to its settings and just active convert digits.

Also you can convert all Latin digits to Arabic with some Js code.

Try something like this (put it in custom JS file and load in each page_

String.prototype.toIndiaDigits= function(){
  var id= ['list of arabic digits'];
 return this.replace(/[0-9]/g, function(w){
  return id[+w]
 });
}
var content= $('body').html();
$('body').html(content.toIndiaDigits());

See this articles about how change Latin digits to Arabic

https://stackoverflow.com/questions/1675786/convert-from-english-digits-to-arabic-ones-in-html-page

https://stackoverflow.com/questions/21415121/convert-english-digits-to-arabic-digits-in-html-documents

http://jsfiddle.net/McxL5/

0

Thanks for the solution. But, the main problem was with the font that I was using when Arabic is loaded. This made the English numeric digits to convert to Arabic automatically. I have now made the same font to be loaded in both the languages. This solved my problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.