Last active
December 23, 2015 18:19
-
-
Save camertron/6674851 to your computer and use it in GitHub Desktop.
Rule-based Number Formatting with twitter-cldr-rb
This file contains hidden or 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
| # clone twitter-cldr-rb, change to rbnf branch | |
| # Note: There are probably bugs with this implementation, and the function names will | |
| # likely change (underscores instead of camel case, for example). Use only with the | |
| # understanding that you will probably have to change your code later. | |
| # | |
| # Any and all questions/comments always appreciated! | |
| require 'twitter_cldr/formatters/numbers/rbnf/en' | |
| puts TwitterCldr::Formatters::RuleBasedNumberFormatter::English.renderDigitsOrdinal(123) | |
| # Alternatively, this also works: | |
| TwitterCldr::Formatters::RuleBasedNumberFormatter.for_locale(:en).renderDigitsOrdinal(123) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment