Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Twitter's Ruby implementation of the Common Locale Data Repository published by the Unicode consortium.
Ruby
Pull request Compare This branch is 980 commits behind twitter:master.

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
js
lib
resources
spec
.gitignore
Gemfile
History.txt
LICENSE
README
Rakefile
twitter_cldr.gemspec
version.txt

README

twitter_cldr
    by Cameron C. Dutro, portions by Sven Fuchs
    http://github.com/camertron, http://github.com/svenfuchs

== DESCRIPTION:

    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/PROBLEMS:

    * CLDR is missing complete number data for: hu (Hungarian), id (Indonesian), msa (Malay), no (Norwegian),
      and 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

== REQUIREMENTS:

    No external requirements.

== INSTALL:

    * gem install twitter_cldr

== LICENSE:

    See LICENSE file.
Something went wrong with that request. Please try again.