TurkishNumeric

Translate any numeric value into Turkish text, currency notation and text representation of money.
Installation
Add this line to your application's Gemfile:
gem 'turkish_numeric'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install turkish_numeric
Usage
First, you should require the gem (if you are using rails you don't need to require).
require 'turkish_numeric'
If you like shorter code lines you can include the module and can use TrNum(numeric_value)
utility method.
Otherwise you should use TurkishNumeric::TrNum.new(numeric_value)
or TurkishNumeric.TrNum(numeric_value)
.
At the examples below, shorter version is used.
include TurkishNumeric
Translating integer numbers
TrNum(0).to_text
TrNum(34_430_002).to_text
TrNum(-999999).to_text
You can translate any integer value from -999 * 1063 to 999 * 1063.
TrNum(999_000_000_999_000_000_000_000_000_000_000_000_000_000_009_900_000_000_000_000_000_000).to_text
Translating floating point numbers
TrNum(1234.00001).to_text
TrNum(34_430_002.45).to_text
TrNum(12.00120012).to_text
TrNum(0.9999999999999999).to_text
Translating as money
TrNum(12.34).to_money
TrNum(120.34).to_money
TrNum(343_211_122_332.45).to_money
Custom currency symbol, thousand seperator, and penny seperator are also supported.
TrNum(12_332.45).to_money(symbol: '€',
thousand_sep: ',',
penny_sep: '.')
Translating as money text
TrNum(234.05).to_money_text
TrNum(600_000.125).to_money_text
Custom currency and sub currency are also supported.
TrNum(234.45).to_money_text(currency: 'USD', sub_currency: 'sent')
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/sbagdat/turkish_numeric. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Code of Conduct
Everyone interacting in the TurkishNumeric project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.