Created
June 11, 2013 12:28
-
-
Save mattsnyder/5756434 to your computer and use it in GitHub Desktop.
Examples of configuring currency for different locales and leveraging Rails ActionView::Helpers to format currency.
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
include ActionView::Helpers # If you want to test from a Rails console | |
number_to_currency(12.34, :locale => :en) # => "$12.34" | |
number_to_currency(12.34, :locale => :ja) # => "12円" | |
number_to_currency(12.34, :locale => 'en-GB') # => "£12.34" |
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
en-GB: | |
number: | |
currency: | |
format: | |
delimiter: ! ',' | |
format: ! '%u%n' | |
precision: 2 | |
separator: . | |
significant: false | |
strip_insignificant_zeros: false | |
unit: £ |
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
en: | |
number: | |
currency: | |
format: | |
delimiter: ! ',' | |
format: ! '%u%n' | |
precision: 2 | |
separator: . | |
significant: false | |
strip_insignificant_zeros: false | |
unit: $ |
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
ja: | |
number: | |
currency: | |
format: | |
delimiter: ! ',' | |
format: ! '%n%u' | |
precision: 0 | |
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