Closed (won't fix)
Project:
Format Number API
Version:
6.x-1.5
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
30 Oct 2009 at 18:14 UTC
Updated:
25 Apr 2012 at 09:10 UTC
hi there
how can i show numbers in page persian (arabic)format
Comments
Comment #1
markus_petrux commentedDo you have a URL to an official spec? Also, an example of what you mean would be nice.
Comment #2
molavy2003 commentedwww.tollabsh.ir
when i select farsi(persian) language in drupal local module .
numbers not translate
so in persian text it show english number
is this in your task?
Comment #3
markus_petrux commentedI'm afraid no one is translating numbers. Drupal itself does not, and Format Number module only deals with decimal point and thousands separator symbols.
I would be glad to try to include this as a new feature in Format Number API. However, I would need a reference to official standards for different representations of numbers, and then it would be possible to evaluate if this is easy to do here, or something that would be better covered from a separate module.
Comment #4
molavy2003 commentedhttp://unicode.org/glossary/
Arabic-Indic digits
http://www.unicode.org/versions/Unicode5.0.0/ch08.pdf#G20596
keep in mind that Persian number just in pages must showed
if them save in sql it will be not search able in internal search
Comment #5
markus_petrux commentedhmm... looking at the file ch08.pdf, it seems we may just need to convert European digits into *something else*, based on the Table 8-1. Arabic Digit Names?
If so, this should only happen on output, when rendering numbers, and we could implement this here as an additional option, next to the current ones that already allow us configure decimal point and thousands separator symbols.
Looks right?
Comment #6
molavy2003 commentedi think so
this is really basic feature
do you think we can request support on next drupal version
or contribute on develop in this case?
Comment #7
molavy2003 commentedwhat about JavaScript?
it will decrease server-side process
Comment #8
molavy2003 commentedany idea?
Comment #9
markus_petrux commentedSorry, I do not have the time right now to work on a patch for this feature. Patches are welcome. I guess the idea would be that we need to add an additional option to choose the digits between "European", "Arabic-Indic", "Eastern Arabic-Indic" and "Indic (Devanagari)". This should be a site wide setting as well as a user setting, the same as the other decpoint and thsep.
In the meantime, you may try with something like this:
Comment #10
molavy2003 commentedabout input textbox
how can i show Persian number while persian and arabic user filling form
and save them on sql in english format?
Comment #11
markus_petrux commentedSupport for Form API elements is something I would like to add in the future to this module, but for the moment, this is not possible due to lack of time.
In the meantime, I think you could do it using your own implementation of hook_form_alter(), and probably #pre_render callback, in custom module. Here you would have to find out the proper form elements, transform the numbers to arabic/persian/whatever before the HTML is sent to the browser. Also, insert an #element_validate callback on top of the list of other possible callbacks for those form elements, and there you can transform the arabic/persian/whatever numbers to european format when the form is sent.
Comment #12
markus_petrux commentedDue to lack of time, also because I do not need this feature for our projects, and Drupal surely allows you to alter the output of anything, it is possible to provide custom solutions on top of this API.
Since no one else seems to be working on this feature I'm marking this issue as won't fix. Feel free to re-open if you can provide a patch for review.
Comment #13
sa3er commentedYou can convert English digits to Persian digits using this JavaScript code in your template:
And also your body tag should have a onload attribute like the following:
<body onload="replaceDigits()">Comment #14
tommann commentedI found a work around for my English/Persian site. If you use an embedded fonts for the Persian/Arabic that uses the same characters set for the numbers as a western fonts the Arabic-Hindi numbers will work.
http://70.40.203.42/