Skip to content

Commit

Permalink
Merge branch 'hotfix/0.0.1.1' into develop
Browse files Browse the repository at this point in the history
Conflicts:
	Changelog.md
	config/defaults.yml
  • Loading branch information
jhass committed Oct 9, 2012
2 parents a0bf172 + 3eb628c commit e6ec419
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Changelog.md
@@ -1,5 +1,8 @@
# 0.0.2.0pre # 0.0.2.0pre


# 0.0.1.1

Fix syntax error in French Javascript pluralization rule.


# 0.0.1.0 # 0.0.1.0


Expand Down
4 changes: 2 additions & 2 deletions config/locales/cldr/plurals.rb
Expand Up @@ -15,7 +15,7 @@
:eu => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : "other" }' } } }, :eu => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : "other" }' } } },
:fi => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : "other" }' } } }, :fi => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : "other" }' } } },
:fil => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other }, :js_rule => 'function (n) { return jQuery.inArray(n, [0, 1]) != -1 ? "one" : "other" }' } } }, :fil => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other }, :js_rule => 'function (n) { return jQuery.inArray(n, [0, 1]) != -1 ? "one" : "other" }' } } },
:fr => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| n.between?(0, 2) && n != 2 ? :one : :other }, :js_rule => 'function (n) { return n.between?(0, 2) && n != 2 ? "one" : "other" }' } } }, :fr => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| n.between?(0, 2) && n != 2 ? :one : :other }, :js_rule => 'function (n) { return n >= 0 && n <= 2 && n != 2 ? "one" : "other" }' } } },
:ga => { :i18n => {:plural => { :keys => [:one, :two, :few, :many, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : [3, 4, 5, 6].include?(n) ? :few : [7, 8, 9, 10].include?(n) ? :many : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : n == 2 ? "two" : jQuery.inArray(n, [3, 4, 5, 6]) != -1 ? "few" : jQuery.inArray(n, [7, 8, 9, 10]) != -1 ? "many" : "other" }' } } }, :ga => { :i18n => {:plural => { :keys => [:one, :two, :few, :many, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : [3, 4, 5, 6].include?(n) ? :few : [7, 8, 9, 10].include?(n) ? :many : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : n == 2 ? "two" : jQuery.inArray(n, [3, 4, 5, 6]) != -1 ? "few" : jQuery.inArray(n, [7, 8, 9, 10]) != -1 ? "many" : "other" }' } } },
:gl => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : "other" }' } } }, :gl => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : "other" }' } } },
:he => { :i18n => {:plural => { :keys => [:one, :two, :many, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : n != 0 ? :many : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : n == 2 ? "two" : n != 0 ? "many" : "other" }' } } }, :he => { :i18n => {:plural => { :keys => [:one, :two, :many, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : n != 0 ? :many : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : n == 2 ? "two" : n != 0 ? "many" : "other" }' } } },
Expand Down Expand Up @@ -49,4 +49,4 @@
:ur => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : "other" }' } } }, :ur => { :i18n => {:plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other }, :js_rule => 'function (n) { return n == 1 ? "one" : "other" }' } } },
:vi => { :i18n => {:plural => { :keys => [:other], :rule => lambda { |n| :other }, :js_rule => 'function (n) { return "other" }' } } }, :vi => { :i18n => {:plural => { :keys => [:other], :rule => lambda { |n| :other }, :js_rule => 'function (n) { return "other" }' } } },
:zh => { :i18n => {:plural => { :keys => [:other], :rule => lambda { |n| :other }, :js_rule => 'function (n) { return "other" }' } } } :zh => { :i18n => {:plural => { :keys => [:other], :rule => lambda { |n| :other }, :js_rule => 'function (n) { return "other" }' } } }
} }
50 changes: 50 additions & 0 deletions spec/locale_spec.rb
@@ -0,0 +1,50 @@
require 'spec_helper'

describe 'locale files' do
describe "cldr/plurals.rb" do
AVAILABLE_LANGUAGE_CODES.each do |locale|
describe "#{locale} plural rules" do
it "defines the keys" do
I18n.with_locale locale do
expect {
I18n.t 'i18n.plural.keys'
}.to_not raise_error
end
end

it "defines a valid pluralization function" do
I18n.with_locale locale do
expect {
rule = I18n.t 'i18n.plural.rule', resolve: false
rule.call(1)
}.to_not raise_error
end
end

it "defines a valid javascript pluralization function" do
I18n.with_locale locale do
expect {
ExecJS.eval I18n.t('i18n.plural.js_rule')
}.to_not raise_error
end
end
end
end
end

AVAILABLE_LANGUAGE_CODES.each do |locale|
["diaspora/#{locale}.yml",
"devise/devise.#{locale}.yml",
"javascript/javascript.#{locale}.yml"].each do |file|
describe file do
it "has no syntax errors if it exists" do
file = Rails.root.join("config", "locales", file)
pending "Not yet available" unless File.exists? file
expect {
YAML.load_file file
}.to_not raise_error
end
end
end
end
end

0 comments on commit e6ec419

Please sign in to comment.