Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #6351 (reopened enhancement)

Opened 2 years ago

Last modified 1 year ago

[PATCH]number_to_currency to support :order for easier localization

Reported by: jesperronn Assigned to: David
Priority: normal Milestone: 1.2.7
Component: ActionPack Version: edge
Severity: normal Keywords:
Cc: chrismear

Description

Like other helpers, number_to_currency should support :order.

Many languages don't have a symbol (like $, £ or €) as unit. but instead a currency with words that is written AFTER the number (such as the Danish "2 kr.")

I think that this patch should be considered in the same way as Bob Silvas ticket 6294 "Make distance_of_time_in_words and company localizable".

Furthermore, adding :order to number_to_currency will make it consistent with date_select that also supports :order

Note that this is not only relevant for minor countries like Denmark, Sweden, Norway, but also for east european countries like Russia and when using international currency codes, like GBP or EUR.

Background list on currencies from wikipedia: http://en.wikipedia.org/wiki/List_of_circulating_currencies

Attachments

to_currency_helper_with_order.patch (2.5 kB) - added by jesperronn on 10/05/06 08:40:57.
to_currency_helper_with_order.2.patch (3.0 kB) - added by chrismear on 10/23/06 15:11:34.
Updated patch with doc and test
to_currency_helper_with_order.3.patch (3.2 kB) - added by jesperronn on 05/05/07 20:33:00.
Updated patch and tested with recent version of trunk (revision 6661)

Change History

10/05/06 08:40:57 changed by jesperronn

  • attachment to_currency_helper_with_order.patch added.

10/05/06 18:21:11 changed by bitsweat

  • status changed from new to closed.
  • resolution set to untested.

10/23/06 15:11:34 changed by chrismear

  • attachment to_currency_helper_with_order.2.patch added.

Updated patch with doc and test

10/23/06 15:12:58 changed by chrismear

  • status changed from closed to reopened.
  • resolution deleted.

I've added a test and documentation to the patch (and amended the code slightly).

10/23/06 15:42:04 changed by chrismear

  • cc set to chrismear.

10/26/06 07:01:04 changed by Jakob S

  • cc changed from chrismear to chrismear, Jakob, S.

Nice, this definitely should be going in. No breakage, well tested, and makes stuff easier for a whole lot of non-english speaking people. +1, I believe the saying goes.

10/26/06 07:31:12 changed by Jakob S

  • cc changed from chrismear, Jakob, S to chrismear.

05/05/07 20:33:00 changed by jesperronn

  • attachment to_currency_helper_with_order.3.patch added.

Updated patch and tested with recent version of trunk (revision 6661)

05/05/07 20:36:59 changed by jesperronn

I believe there was an error in attatchment 2.patch (returning an array in stead of a string).

I added the corrected 3.patch file which also is tested with current version of trunk.

( copenhagen.rb rails patch day )