-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Creating an English driver #2
Conversation
…and how it passes data through to the transformer
@janhartigan Just to give you a quick overview, I've decided to create this component, because the only library which does the same thing was created 10 years ago and looks a bit doggy. Problems I had in here, were to create a representation of fractal part of money amount. I'm still wondering how I should build value objects. If you want to use this component in your project I can create a tag with a stable release (0.0.1), to make your composer not complaining about stability of dependencies. Just let me know. Thanks. |
@kwn cool, sounds good. I'll set up another issue to talk about my ideas for what I think is the optimal interface for using this package. It's barely different from what you have so far, but I feel it warrants a separate issue. Once we have that ironed out, we can maybe tweak the readme a bit to make it easier to figure out how to use it. Again...huge respect for taking the time to make this library. |
Great PR 👍 Good point with |
* Serbian language added - with tests * Serbian language corrected - added separators, fixed exponents - improved tests Added Serbian language currency setup and test - fix the gender for the unit cents - removed the not needed class * Added the currencies to README.md * Serbian language - removed not needed inflector * Serbian language, additional cleanup * Serbian language, cleanup #2 * Fix the bad locale 2-letter code --------- Co-authored-by: Andrej Mićić <amicic@someemail.com>
I'm actually a big fan of the way you've set this up, with a few minor exceptions. You set it up to be decently extensible and the architecture gave me some freedom to set up English in such a way that is optimal for its various quirks. Nice job. I'm guessing the biggest reason this is a fairly unused library is because it is made for Polish and Romanian. Since I need an English driver for this library, I made one for you.
Note that there is also a commit that modifies the transformer factory interface a bit to match how you were calling it in this test. Once I got a bit further into developing the English driver, I realized that the
Amount
instance actually holds a lot of information about how to do the transformation. I suspect that we could get away with simply passing aNumber
to the currency transformer and use theCurrency
andSubunitFormat
integer from when the transformer is constructed. Seems a bit odd to have a distinct class calledAmount
, which is sort of just another word for "number".I tried to follow your general style as closely as possible. I made a fairly extensive test suite that tests all currencies for English. Please let me know if you have any questions or comments.