Closed Prinzhorn closed 12 years ago
+1
However, it should be :currency
instead of :money
, as currency is the more frequently used term in programming languages and currencies. (Greater familiarity, etc.) Or you could even alias the two to the same function.
Right, :money
was just the first thing that came to my mind.
Totally agree. I've only needed en-US thus far so that's where the method name came from. Ideally, I think :money
or :currency
would be a far better name for the filter, assuming the "current locale" format. It might be nice to keep :dollar
and other country-specific money-names around to specify a format outside of the "current locale" if needed. Thoughts on that?
Instead of bloating everything up by adding :euro
, :yen
and the like as well (if that's what you meant), I think it would be better to have a :currency
filter which by default uses the current locale and has optional parameters for currency symbol, separators and decimal places.
By the way is there a open source project for such formating stuff with a comprehensive list of cultures? I've worked with .NET and loved how everything just worked. DateTime.toString, Number.toString and stuff are all culture aware and automatically return the appropriate result without passing any arguments.
Good call, that helps. http://josscrowcroft.github.com/accounting.js/ looks super promising, but I'm hesitant to add a dependency. Would it be that bad to add a dependency for a filter package as long as core doesn't depend on it?
Yeah, looks good (I think I came across this some time ago).
Turn your concerns upside down and you're set. Instead of "aw no, we add a dependency", say "hell yes, walrus is so awesome and flexible, it has multiple optional modules"
I think putting in a dependency for accounting.js is wise; Walrus.js is a view/templating engine, not a currency formatter. But, I would make it a dynamic dependency with a basic fallback that provides very rudimentary formatting.
I think putting in a dependency for accounting.js is wise; Walrus.js is a view/templating engine, not a currency formatter. But, I would make it a dynamic dependency with a basic fallback that provides very rudimentary formatting.
The default USD formatting could be kept and adding the accounting.js plugin overwrites the filter function.
Thanks guys, basic i18n for currency formatting is in, takes advantage of accounting.js if available.
The USA are not the center of the world (related to #19).
Instead of having a
:dollar
filter it should much rather be:money
and accept a currency (maybe even format string like:strftime
) and decimal separators. Going a step further, the decimal separators should be globally set according to a language/culture (again, related to #19).Anyway, I like walrus. Well done.