0

I have a web application with embedded fonts. There is a small problem. Language of my web application is Persian and English but all numbers in the web page are shown in Persian even the numbers in the English content. This is the screenshot of web application.

Web application in English Web application in Persian

Is there any way to show numbers like Microsoft Word (use Persian numbers in Persian text and English numbers in English text)?

Hadi Barak
  • 480
  • 1
  • 4
  • 17

2 Answers2

1

Technically, you could put both common European digits 0, 1, 2… and Arabic digits ٠‎‎, ١‎‎‎, ٢‎‎, … as alternative glyphs for the characters U+0030 DIGIT ZERO, U+0031 DIGIT ONE, U+0032 DIGIT TWO, etc.,into the same font, using OpenType features, and you could use CSS tools for selecting between (though this is not yet supported by all browsers). But then you would need to be a font designer, or at least know how to edit a font.

The normal way, however, is to treat European digits and Arabic digits as distinct characters, i.e. make the difference at the character level. So the code that generates the calendar should take care of the issue. And then you just need a font that has both sets of digits, properly assigned to the separate characters.

Jukka K. Korpela
  • 195,524
  • 37
  • 270
  • 390
  • Thanks for your answer. my application is bilingual, user can select either Persian or English Language and the output is generated by same code so i think it's not possible to change the code or even if it's possible, it's very hard to implement (all of the application's code should be changed). once again thanks for your answer :) – Hadi Barak Mar 28 '14 at 07:40
  • 1
    So apparently the application has not been internationalized/localized properly: it seems to write Arabic digits for both languages (or, alternatively, it writes common digits 0, 1, 2... and uses a font trick to render as Arabic digits). If the application is otherwise well-designed, it should be a simple matter to make the adjustment, since it’s really just a matter of adding a parameter constant to the character code value when you are about to write a digit. – Jukka K. Korpela Mar 28 '14 at 09:06
0

Its quite easy if you use lang attribute inside the parent div of your calendar:

<div lang="en" style="font-family:Tahoma"> <!--Calendar code here --> </div>

Amin
  • 579
  • 7
  • 23