Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into kl_abbr_numbers_pluralization
Conflicts: lib/twitter_cldr/formatters/numbers/abbreviated/abbreviated_number_formatter.rb resources/locales/bn/numbers.yml resources/locales/de-CH/numbers.yml resources/locales/de/numbers.yml resources/locales/es-CO/numbers.yml resources/locales/es-MX/numbers.yml resources/locales/es-US/numbers.yml resources/locales/es/numbers.yml resources/locales/eu/numbers.yml resources/locales/fr-CA/numbers.yml resources/locales/ga/numbers.yml resources/locales/he/numbers.yml resources/locales/hi/numbers.yml resources/locales/it-CH/numbers.yml resources/locales/it/numbers.yml resources/locales/ko/numbers.yml resources/locales/sr/numbers.yml resources/locales/ur/numbers.yml spec/formatters/numbers/abbreviated/long_decimal_formatter_spec.rb
- Loading branch information
Showing
105 changed files
with
9,392 additions
and
5,925 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# encoding: UTF-8 | ||
|
||
# Copyright 2012 Twitter, Inc | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
module TwitterCldr | ||
module Formatters | ||
module Rbnf | ||
|
||
class Plural | ||
def self.from_string(locale, str) | ||
# $(cardinal,one{ tysiąc}few{ tysiące}other{ tysięcy})$ | ||
plural_type, cases = str.gsub(/\$\((.*)\)\$/, '\1').split(',') | ||
|
||
# one{ tysiąc}few{ tysiące}other{ tysięcy} | ||
cases = cases.scan(/([\w]+)\{([^}]+)\}/).inject({}) do |ret, case_arr| | ||
ret[case_arr.first.to_sym] = case_arr.last | ||
ret | ||
end | ||
|
||
new(locale, plural_type.to_sym, cases) | ||
end | ||
|
||
attr_reader :locale, :plural_type, :cases | ||
|
||
# plural_type = cardinal, etc | ||
# cases = hash of form one: "foo", two: "bar" | ||
def initialize(locale, plural_type, cases) | ||
@locale = locale | ||
@plural_type = plural_type | ||
@cases = cases | ||
end | ||
|
||
def render(number) | ||
rule_name = TwitterCldr::Formatters::Plurals::Rules.rule_for( | ||
number, locale, plural_type | ||
) | ||
|
||
cases[rule_name] || cases[:other] | ||
end | ||
|
||
def type | ||
:plural | ||
end | ||
end | ||
|
||
end | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,4 @@ def decimal_format | |
|
||
end | ||
end | ||
end | ||
end |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,3 +108,4 @@ | |
:percent_sign: "%" | ||
:plus_sign: "+" | ||
:superscripting_exponent: "×" | ||
:time_separator: ":" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -208,3 +208,4 @@ | |
:percent_sign: "%" | ||
:plus_sign: "+" | ||
:superscripting_exponent: "×" | ||
:time_separator: ":" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,3 +108,4 @@ | |
:percent_sign: "%" | ||
:plus_sign: "+" | ||
:superscripting_exponent: "×" | ||
:time_separator: ":" |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,3 +108,4 @@ | |
:percent_sign: "%" | ||
:plus_sign: "+" | ||
:superscripting_exponent: "×" | ||
:time_separator: ":" |
Oops, something went wrong.