Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonne Haß <me@mrzyx.de>2012-10-10 00:22:49 +0400
committerJonne Haß <me@mrzyx.de>2012-10-10 00:36:30 +0400
commit3eb628c2a323d5c2c104a262592af7b8db08fd6e (patch)
treeb7afac8f517a2ec1ce966deed5ffaebd1d551b1f
parent1f9f0c29324d7f280f3637c6246524a6a4840415 (diff)
fix french javascript pluralization rule and add specs for locale loadingv0.0.1.1
-rw-r--r--Changelog.md4
-rw-r--r--config/defaults.yml2
-rw-r--r--config/locales/cldr/plurals.rb4
-rw-r--r--spec/locale_spec.rb50
4 files changed, 57 insertions, 3 deletions
diff --git a/Changelog.md b/Changelog.md
index 72a3abf4d..500303cbf 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -1,3 +1,7 @@
+# 0.0.1.1
+
+Fix syntax error in French Javascript pluralization rule.
+
# 0.0.1.0
## New configuration system!
diff --git a/config/defaults.yml b/config/defaults.yml
index ee35209c2..0f5824620 100644
--- a/config/defaults.yml
+++ b/config/defaults.yml
@@ -4,7 +4,7 @@
defaults:
version:
- number: "0.0.1.0"
+ number: "0.0.1.1"
release: true # Do not touch unless in a merge conflict on doing a release, master should have a commit setting this to true which is not backported to the develop branch.
heroku: false
environment:
diff --git a/config/locales/cldr/plurals.rb b/config/locales/cldr/plurals.rb
index 039afc521..01b566342 100644
--- a/config/locales/cldr/plurals.rb
+++ b/config/locales/cldr/plurals.rb
@@ -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" }' } } },
: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" }' } } },
- :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" }' } } },
: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" }' } } },
@@ -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" }' } } },
: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" }' } } }
-} \ No newline at end of file
+}
diff --git a/spec/locale_spec.rb b/spec/locale_spec.rb
new file mode 100644
index 000000000..0ba8c31cd
--- /dev/null
+++ b/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