Created
December 28, 2012 00:14
-
-
Save anonymous/4393419 to your computer and use it in GitHub Desktop.
Accounting friendly negative number formatting. By configuring the `negative_format`, Rail's `number_to_currency` helper method will display negative numbers with parenthesis.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find this file in config/locales/en.yml | |
# http://guides.rubyonrails.org/i18n.html | |
# https://github.com/svenfuchs/rails-i18n/blob/master/rails/locale/en.yml | |
number: | |
currency: | |
format: | |
delimiter: "," | |
format: "%u%n" | |
negative_format: "(%u%n)" # <-- wrap negative numbers in parenthesis | |
precision: 2 | |
separator: . | |
significant: false | |
strip_insignificant_zeros: false | |
unit: $ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment