Permalink
Browse files

Update README.md

  • Loading branch information...
caniszczyk committed Mar 27, 2012
1 parent 9e6fdb3 commit 4c751ac1ee27b996791fcedb188da3e06e6a2a76
Showing with 56 additions and 39 deletions.
  1. +56 −39 README.md
View
@@ -1,50 +1,67 @@
## twitter-cldr-rb
- TwitterCldr uses Unicode's Common Locale Data Repository (CLDR) to format certain types of text into their
- localized equivalents. Currently supported types of text include dates, times, currencies, decimals, and percentages.
+TwitterCldr uses Unicode's Common Locale Data Repository (CLDR) to format certain types of text into their
+localized equivalents. Currently supported types of text include dates, times, currencies, decimals, and percentages.
## Features
- * CLDR is missing complete number data for: hu (Hungarian), id (Indonesian), msa (Malay), no (Norwegian),
- and zh-tw (Traditional Chinese)
+CLDR is missing complete number data for:
+
+* hu (Hungarian)
+* id (Indonesian)
+* msa (Malay)
+* no (Norwegian),
+* zh-tw (Traditional Chinese)
## Synopsis
- TwitterCldr patches core Ruby objects like Fixnum and Date for an easy localization experience:
-
- 1. Numbers (Fixnum, Bignum, and Float objects are supported)
- 1337.localize(:es).to_s # 1.337
- 1337.localize(:es).to_currency.to_s # $1.337,00
- 1337.localize(:es).to_currency.to_s(:currency => "EUR") # €1.337,00
- 1337.localize(:es).to_currency.to_s(:currency => "Peru") # S/.1.337,00
- 1337.localize(:es).to_percent.to_s # 1.337%
- 1337.localize(:es).to_percent.to_s(:precision => 2) # 1.337,00%
-
- NOTE: The :precision option can be used with all these number formatters.
-
- 2. Dates and Times (Date, Time, and DateTime objects are supported)
- DateTime.now.localize(:es).to_full_s # 21:44:57 UTC -0800 lunes 12 de diciembre de 2011
- DateTime.now.localize(:es).to_long_s # 21:45:42 -08:00 12 de diciembre de 2011
- DateTime.now.localize(:es).to_medium_s # 21:46:09 12/12/2011
- DateTime.now.localize(:es).to_short_s # 21:47 12/12/11
-
- Date.today.localize(:es).to_full_s # lunes 12 de diciembre de 2011
- Date.today.localize(:es).to_long_s # 12 de diciembre de 2011
- Date.today.localize(:es).to_medium_s # 12/12/2011
- Date.today.localize(:es).to_short_s # 12/12/11
-
- Time.now.localize(:es).to_full_s # 21:44:57 UTC -0800
- Time.now.localize(:es).to_long_s # 21:45:42 -08:00
- Time.now.localize(:es).to_medium_s # 21:46:09
- Time.now.localize(:es).to_short_s # 21:47
-
- 3. Plural Rules
- 1.localize(:ru).plural_rule # :one
- 2.localize(:ru).plural_rule # :few
- 5.localize(:ru).plural_rule # :many
-
- 4. World Languages
- :es.localize(:es).as_language_code # español
+TwitterCldr patches core Ruby objects like Fixnum and Date for an easy localization experience:
+
+Numbers (Fixnum, Bignum, and Float objects are supported):
+
+```ruby
+1337.localize(:es).to_s # 1.337
+1337.localize(:es).to_currency.to_s # $1.337,00
+1337.localize(:es).to_currency.to_s(:currency => "EUR") # €1.337,00
+1337.localize(:es).to_currency.to_s(:currency => "Peru") # S/.1.337,00
+1337.localize(:es).to_percent.to_s # 1.337%
+1337.localize(:es).to_percent.to_s(:precision => 2) # 1.337,00%
+```
+
+NOTE: The :precision option can be used with all these number formatters.
+
+Dates and Times (Date, Time, and DateTime objects are supported):
+
+```ruby
+DateTime.now.localize(:es).to_full_s # 21:44:57 UTC -0800 lunes 12 de diciembre de 2011
+DateTime.now.localize(:es).to_long_s # 21:45:42 -08:00 12 de diciembre de 2011
+DateTime.now.localize(:es).to_medium_s # 21:46:09 12/12/2011
+DateTime.now.localize(:es).to_short_s # 21:47 12/12/11
+
+Date.today.localize(:es).to_full_s # lunes 12 de diciembre de 2011
+Date.today.localize(:es).to_long_s # 12 de diciembre de 2011
+Date.today.localize(:es).to_medium_s # 12/12/2011
+Date.today.localize(:es).to_short_s # 12/12/11
+
+Time.now.localize(:es).to_full_s # 21:44:57 UTC -0800
+Time.now.localize(:es).to_long_s # 21:45:42 -08:00
+Time.now.localize(:es).to_medium_s # 21:46:09
+Time.now.localize(:es).to_short_s # 21:47
+```
+
+Plural Rules:
+
+```ruby
+1.localize(:ru).plural_rule # :one
+2.localize(:ru).plural_rule # :few
+5.localize(:ru).plural_rule # :many
+```
+
+World Languages:
+
+```ruby
+:es.localize(:es).as_language_code # español
+```
## Requirements

0 comments on commit 4c751ac

Please sign in to comment.