i18n 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of i18n might be problematic. Click here for more details.
- data/README.textile +2 -0
- data/lib/i18n.rb +6 -5
- data/lib/i18n/backend/base.rb +7 -1
- data/lib/i18n/backend/cache.rb +1 -1
- data/lib/i18n/backend/cascade.rb +1 -0
- data/lib/i18n/backend/fallbacks.rb +8 -11
- data/lib/i18n/backend/gettext.rb +2 -1
- data/lib/i18n/backend/key_value.rb +2 -2
- data/lib/i18n/backend/pluralization.rb +2 -4
- data/lib/i18n/locale/fallbacks.rb +5 -5
- data/lib/i18n/version.rb +1 -1
- data/test/api/override_test.rb +48 -0
- data/test/backend/fallbacks_test.rb +5 -0
- data/test/backend/metadata_test.rb +1 -21
- data/test/gettext/backend_test.rb +8 -0
- data/test/i18n_test.rb +18 -0
- data/test/locale/fallbacks_test.rb +12 -0
- data/test/test_data/locales/de.po +10 -0
- data/test/test_data/locales/invalid/empty.yml +0 -1
- data/test/test_data/locales/plurals.rb +2 -2
- metadata +71 -86
data/README.textile
CHANGED
data/lib/i18n.rb
CHANGED
@@ -12,7 +12,7 @@ module I18n
|
|
12
12
|
RESERVED_KEYS = [:scope, :default, :separator, :resolve, :object, :fallback, :format, :cascade, :throw, :raise, :rescue_format]
|
13
13
|
RESERVED_KEYS_PATTERN = /%\{(#{RESERVED_KEYS.join("|")})\}/
|
14
14
|
|
15
|
-
|
15
|
+
extend Module.new {
|
16
16
|
# Gets I18n configuration object.
|
17
17
|
def config
|
18
18
|
Thread.current[:i18n_config] ||= I18n::Config.new
|
@@ -160,6 +160,8 @@ module I18n
|
|
160
160
|
end
|
161
161
|
alias :t :translate
|
162
162
|
|
163
|
+
# Wrapper for <tt>translate</tt> that adds <tt>:raise => true</tt>. With
|
164
|
+
# this option, if no translation is found, it will raise <tt>I18n::MissingTranslationData</tt>
|
163
165
|
def translate!(key, options={})
|
164
166
|
translate(key, options.merge(:raise => true))
|
165
167
|
end
|
@@ -220,12 +222,11 @@ module I18n
|
|
220
222
|
options = args.pop if args.last.is_a?(Hash)
|
221
223
|
key = args.shift
|
222
224
|
locale = options && options.delete(:locale) || config.locale
|
223
|
-
|
225
|
+
handling = options && (options.delete(:throw) && :throw || options.delete(:raise) && :raise)
|
224
226
|
replacement = options && options.delete(:replacement)
|
225
227
|
config.backend.transliterate(locale, key, replacement)
|
226
228
|
rescue I18n::ArgumentError => exception
|
227
|
-
|
228
|
-
handle_exception(exception, locale, key, options)
|
229
|
+
handle_exception(handling, exception, locale, key, options || {})
|
229
230
|
end
|
230
231
|
|
231
232
|
# Localizes certain objects, such as dates and numbers to local formatting.
|
@@ -327,5 +328,5 @@ module I18n
|
|
327
328
|
"(an instance of which is set to I18n.exception_handler by default)."
|
328
329
|
exception.is_a?(MissingTranslation) ? exception.message : raise(exception)
|
329
330
|
end
|
330
|
-
|
331
|
+
}
|
331
332
|
end
|
data/lib/i18n/backend/base.rb
CHANGED
@@ -168,7 +168,13 @@ module I18n
|
|
168
168
|
# Loads a YAML translations file. The data must have locales as
|
169
169
|
# toplevel keys.
|
170
170
|
def load_yml(filename)
|
171
|
-
|
171
|
+
begin
|
172
|
+
YAML.load_file(filename)
|
173
|
+
rescue TypeError
|
174
|
+
nil
|
175
|
+
rescue SyntaxError
|
176
|
+
nil
|
177
|
+
end
|
172
178
|
end
|
173
179
|
end
|
174
180
|
end
|
data/lib/i18n/backend/cache.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
# To enable caching you can simply include the Cache module to the Simple
|
5
5
|
# backend - or whatever other backend you are using:
|
6
6
|
#
|
7
|
-
# I18n::Backend::Simple.include
|
7
|
+
# I18n::Backend::Simple.send(:include, I18n::Backend::Cache)
|
8
8
|
#
|
9
9
|
# You will also need to set a cache store implementation that you want to use:
|
10
10
|
#
|
data/lib/i18n/backend/cascade.rb
CHANGED
@@ -31,12 +31,12 @@ module I18n
|
|
31
31
|
# the given options. If it does not find any result for any of the
|
32
32
|
# locales it will then throw MissingTranslation as usual.
|
33
33
|
#
|
34
|
-
# The default option takes precedence over fallback locales
|
35
|
-
#
|
34
|
+
# The default option takes precedence over fallback locales only when
|
35
|
+
# it's a Symbol. When the default contains a String, Proc or Hash
|
36
36
|
# it is evaluated last after all the fallback locales have been tried.
|
37
37
|
def translate(locale, key, options = {})
|
38
38
|
return super if options[:fallback]
|
39
|
-
default =
|
39
|
+
default = extract_non_symbol_default!(options) if options[:default]
|
40
40
|
|
41
41
|
options[:fallback] = true
|
42
42
|
I18n.fallbacks[locale].each do |fallback|
|
@@ -51,18 +51,15 @@ module I18n
|
|
51
51
|
throw(:exception, I18n::MissingTranslation.new(locale, key, options))
|
52
52
|
end
|
53
53
|
|
54
|
-
def
|
54
|
+
def extract_non_symbol_default!(options)
|
55
55
|
defaults = [options[:default]].flatten
|
56
|
-
|
57
|
-
|
58
|
-
defaults[index]
|
56
|
+
first_non_symbol_default = defaults.detect{|default| !default.is_a?(Symbol)}
|
57
|
+
if first_non_symbol_default
|
58
|
+
options[:default] = defaults[0, defaults.index(first_non_symbol_default)]
|
59
59
|
end
|
60
|
+
return first_non_symbol_default
|
60
61
|
end
|
61
62
|
|
62
|
-
def find_first_string_or_lambda_default(defaults)
|
63
|
-
defaults.each_with_index { |default, ix| return ix if String === default || Proc === default }
|
64
|
-
nil
|
65
|
-
end
|
66
63
|
end
|
67
64
|
end
|
68
65
|
end
|
data/lib/i18n/backend/gettext.rb
CHANGED
@@ -40,6 +40,7 @@ module I18n
|
|
40
40
|
def normalize(locale, data)
|
41
41
|
data.inject({}) do |result, (key, value)|
|
42
42
|
unless key.nil? || key.empty?
|
43
|
+
key = key.gsub(I18n::Gettext::CONTEXT_SEPARATOR, '|')
|
43
44
|
key, value = normalize_pluralization(locale, key, value) if key.index("\000")
|
44
45
|
|
45
46
|
parts = key.split('|').reverse
|
@@ -59,7 +60,7 @@ module I18n
|
|
59
60
|
|
60
61
|
keys = I18n::Gettext.plural_keys(locale)
|
61
62
|
values = value.split("\000")
|
62
|
-
raise "invalid number of plurals: #{values.size}, keys: #{keys.inspect}" if values.size != keys.size
|
63
|
+
raise "invalid number of plurals: #{values.size}, keys: #{keys.inspect} on #{locale} locale for msgid #{key.inspect} with values #{values.inspect}" if values.size != keys.size
|
63
64
|
|
64
65
|
result = {}
|
65
66
|
values.each_with_index { |_value, ix| result[keys[ix]] = _value }
|
@@ -73,7 +73,7 @@ module I18n
|
|
73
73
|
raise "Key-value stores cannot handle procs"
|
74
74
|
end
|
75
75
|
|
76
|
-
@store[key] = ActiveSupport::JSON.encode(value) unless value.is_a?(Symbol)
|
76
|
+
@store[key] = ActiveSupport::JSON.encode([value]) unless value.is_a?(Symbol)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -90,7 +90,7 @@ module I18n
|
|
90
90
|
def lookup(locale, key, scope = [], options = {})
|
91
91
|
key = normalize_flat_keys(locale, key, scope, options[:separator])
|
92
92
|
value = @store["#{locale}.#{key}"]
|
93
|
-
value = ActiveSupport::JSON.decode(value) if value
|
93
|
+
value = ActiveSupport::JSON.decode(value)[0] if value
|
94
94
|
value.is_a?(Hash) ? value.deep_symbolize_keys : value
|
95
95
|
end
|
96
96
|
end
|
@@ -1,7 +1,5 @@
|
|
1
|
-
# I18n
|
2
|
-
#
|
3
|
-
# missing. E.g. you might want to use :en translations when translations in
|
4
|
-
# your applications main locale :de are missing.
|
1
|
+
# I18n Pluralization are useful when you want your application to
|
2
|
+
# customize pluralization rules.
|
5
3
|
#
|
6
4
|
# To enable locale specific pluralizations you can simply include the
|
7
5
|
# Pluralization module to the Simple backend - or whatever other backend you
|
@@ -25,12 +25,12 @@
|
|
25
25
|
# # using the default locale as default fallback locale
|
26
26
|
#
|
27
27
|
# I18n.default_locale = :"en-US"
|
28
|
-
# I18n.fallbacks = I18n::Fallbacks.new(:"de-AT" => :"de-DE")
|
28
|
+
# I18n.fallbacks = I18n::Locale::Fallbacks.new(:"de-AT" => :"de-DE")
|
29
29
|
# I18n.fallbacks[:"de-AT"] # => [:"de-AT", :"de-DE", :de, :"en-US", :en]
|
30
30
|
#
|
31
31
|
# # using a custom locale as default fallback locale
|
32
32
|
#
|
33
|
-
# I18n.fallbacks = I18n::Fallbacks.new(:"en-GB", :"de-AT" => :de, :"de-CH" => :de)
|
33
|
+
# I18n.fallbacks = I18n::Locale::Fallbacks.new(:"en-GB", :"de-AT" => :de, :"de-CH" => :de)
|
34
34
|
# I18n.fallbacks[:"de-AT"] # => [:"de-AT", :de, :"en-GB", :en]
|
35
35
|
# I18n.fallbacks[:"de-CH"] # => [:"de-CH", :de, :"en-GB", :en]
|
36
36
|
#
|
@@ -82,10 +82,10 @@ module I18n
|
|
82
82
|
|
83
83
|
protected
|
84
84
|
|
85
|
-
def compute(tags, include_defaults = true)
|
85
|
+
def compute(tags, include_defaults = true, exclude = [])
|
86
86
|
result = Array(tags).collect do |tag|
|
87
|
-
tags = I18n::Locale::Tag.tag(tag).self_and_parents.map! { |t| t.to_sym }
|
88
|
-
tags.each { |_tag| tags += compute(@map[_tag]) if @map[_tag] }
|
87
|
+
tags = I18n::Locale::Tag.tag(tag).self_and_parents.map! { |t| t.to_sym } - exclude
|
88
|
+
tags.each { |_tag| tags += compute(@map[_tag], false, exclude + tags) if @map[_tag] }
|
89
89
|
tags
|
90
90
|
end.flatten
|
91
91
|
result.push(*defaults) if include_defaults
|
data/lib/i18n/version.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class I18nOverrideTest < Test::Unit::TestCase
|
4
|
+
module OverrideInverse
|
5
|
+
|
6
|
+
def translate(*args)
|
7
|
+
super(*args).reverse
|
8
|
+
end
|
9
|
+
alias :t :translate
|
10
|
+
|
11
|
+
end
|
12
|
+
|
13
|
+
module OverrideSignature
|
14
|
+
|
15
|
+
def translate(*args)
|
16
|
+
args.first + args[1]
|
17
|
+
end
|
18
|
+
alias :t :translate
|
19
|
+
|
20
|
+
end
|
21
|
+
|
22
|
+
def setup
|
23
|
+
@I18n = I18n.dup
|
24
|
+
@I18n.backend = I18n::Backend::Simple.new
|
25
|
+
super
|
26
|
+
end
|
27
|
+
|
28
|
+
test "make sure modules can overwrite I18n methods" do
|
29
|
+
@I18n.extend OverrideInverse
|
30
|
+
@I18n.backend.store_translations('en', :foo => 'bar')
|
31
|
+
|
32
|
+
assert_equal 'rab', @I18n.translate(:foo, :locale => 'en')
|
33
|
+
# FIXME: this fails under 1.8.7
|
34
|
+
# assert_equal 'rab', @I18n.t(:foo, :locale => 'en')
|
35
|
+
assert_equal 'rab', @I18n.translate!(:foo, :locale => 'en')
|
36
|
+
assert_equal 'rab', @I18n.t!(:foo, :locale => 'en')
|
37
|
+
end
|
38
|
+
|
39
|
+
test "make sure modules can overwrite I18n signature" do
|
40
|
+
exception = catch(:exception) do
|
41
|
+
@I18n.t('Hello', 'Welcome message on home page', :tokenize => true, :throw => true)
|
42
|
+
end
|
43
|
+
assert exception.message
|
44
|
+
@I18n.extend OverrideSignature
|
45
|
+
assert_equal 'HelloWelcome message on home page', @I18n.translate('Hello', 'Welcome message on home page', :tokenize => true) # tr8n example
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -48,6 +48,11 @@ class I18nBackendFallbacksTranslateTest < Test::Unit::TestCase
|
|
48
48
|
assert_equal "Default Bar", I18n.t(:missing_bar, :locale => :'de-DE', :default => Proc.new { "Default Bar" })
|
49
49
|
end
|
50
50
|
|
51
|
+
test "returns the :de translation for a missing :'de-DE' when :default is a Hash" do
|
52
|
+
assert_equal 'Bar in :de', I18n.t(:bar, :locale => :'de-DE', :default => {})
|
53
|
+
assert_equal({}, I18n.t(:missing_bar, :locale => :'de-DE', :default => {}))
|
54
|
+
end
|
55
|
+
|
51
56
|
test "returns the :'de-DE' default :baz translation for a missing :'de-DE' when defaults contains Symbol" do
|
52
57
|
assert_equal 'Baz in :de-DE', I18n.t(:missing_foo, :locale => :'de-DE', :default => [:baz, "Default Bar"])
|
53
58
|
end
|
@@ -16,16 +16,6 @@ class I18nBackendMetadataTest < Test::Unit::TestCase
|
|
16
16
|
assert translation.translation_metadata.is_a?(Hash)
|
17
17
|
end
|
18
18
|
|
19
|
-
test "translate preserves metadata stored on original Strings" do
|
20
|
-
store_metadata(:foo, :bar, 'bar')
|
21
|
-
assert_equal 'bar', I18n.t(:foo, :name => 'David').translation_metadata[:bar]
|
22
|
-
end
|
23
|
-
|
24
|
-
test "translate preserves metadata stored on original Strings (when interpolated)" do
|
25
|
-
store_metadata(:foo, :bar, 'bar')
|
26
|
-
assert_equal 'bar', I18n.t(:foo, :name => 'David').translation_metadata[:bar]
|
27
|
-
end
|
28
|
-
|
29
19
|
test "translate adds the locale to metadata on Strings" do
|
30
20
|
assert_equal :en, I18n.t(:foo, :name => 'David', :locale => :en).translation_metadata[:locale]
|
31
21
|
end
|
@@ -33,7 +23,7 @@ class I18nBackendMetadataTest < Test::Unit::TestCase
|
|
33
23
|
test "translate adds the key to metadata on Strings" do
|
34
24
|
assert_equal :foo, I18n.t(:foo, :name => 'David').translation_metadata[:key]
|
35
25
|
end
|
36
|
-
|
26
|
+
|
37
27
|
test "translate adds the default to metadata on Strings" do
|
38
28
|
assert_equal 'bar', I18n.t(:foo, :default => 'bar', :name => '').translation_metadata[:default]
|
39
29
|
end
|
@@ -53,15 +43,5 @@ class I18nBackendMetadataTest < Test::Unit::TestCase
|
|
53
43
|
test "metadata works with frozen values" do
|
54
44
|
assert_equal(1, I18n.t(:missing, :count => 1, :default => 'foo'.freeze).translation_metadata[:count])
|
55
45
|
end
|
56
|
-
|
57
|
-
protected
|
58
|
-
|
59
|
-
def translations
|
60
|
-
I18n.backend.instance_variable_get(:@translations)
|
61
|
-
end
|
62
|
-
|
63
|
-
def store_metadata(key, name, value)
|
64
|
-
translations[:en][key].translation_metadata[name] = value
|
65
|
-
end
|
66
46
|
end
|
67
47
|
|
@@ -43,11 +43,13 @@ unless RUBY_VERSION == '1.9.1' && RUBY_PATCHLEVEL <= 129
|
|
43
43
|
I18n.locale = :de
|
44
44
|
assert_equal 'Räderzahl', sgettext('Car|Wheels count')
|
45
45
|
assert_equal 'Räderzahl', pgettext('Car', 'Wheels count')
|
46
|
+
assert_equal 'Räderzahl!', pgettext('New car', 'Wheels count')
|
46
47
|
end
|
47
48
|
|
48
49
|
def test_uses_namespaced_default_translation
|
49
50
|
assert_equal 'Wheels count', sgettext('Car|Wheels count')
|
50
51
|
assert_equal 'Wheels count', pgettext('Car', 'Wheels count')
|
52
|
+
assert_equal 'Wheels count', pgettext('New car', 'Wheels count')
|
51
53
|
end
|
52
54
|
|
53
55
|
def test_pluralizes_entry
|
@@ -67,6 +69,8 @@ unless RUBY_VERSION == '1.9.1' && RUBY_PATCHLEVEL <= 129
|
|
67
69
|
assert_equal 'Räder', nsgettext('Car|wheel', 'wheels', 2)
|
68
70
|
assert_equal 'Rad', npgettext('Car', 'wheel', 'wheels', 1)
|
69
71
|
assert_equal 'Räder', npgettext('Car', 'wheel', 'wheels', 2)
|
72
|
+
assert_equal 'Rad!', npgettext('New car', 'wheel', 'wheels', 1)
|
73
|
+
assert_equal 'Räder!', npgettext('New car', 'wheel', 'wheels', 2)
|
70
74
|
end
|
71
75
|
|
72
76
|
def test_pluralizes_namespaced_default_entry
|
@@ -74,6 +78,8 @@ unless RUBY_VERSION == '1.9.1' && RUBY_PATCHLEVEL <= 129
|
|
74
78
|
assert_equal 'wheels', nsgettext('Car|wheel', 'wheels', 2)
|
75
79
|
assert_equal 'wheel', npgettext('Car', 'wheel', 'wheels', 1)
|
76
80
|
assert_equal 'wheels', npgettext('Car', 'wheel', 'wheels', 2)
|
81
|
+
assert_equal 'wheel', npgettext('New car', 'wheel', 'wheels', 1)
|
82
|
+
assert_equal 'wheels', npgettext('New car', 'wheel', 'wheels', 2)
|
77
83
|
end
|
78
84
|
|
79
85
|
def test_pluralizes_namespaced_entry_with_alternative_syntax
|
@@ -82,6 +88,8 @@ unless RUBY_VERSION == '1.9.1' && RUBY_PATCHLEVEL <= 129
|
|
82
88
|
assert_equal 'Räder', nsgettext(['Car|wheel', 'wheels'], 2)
|
83
89
|
assert_equal 'Rad', npgettext('Car', ['wheel', 'wheels'], 1)
|
84
90
|
assert_equal 'Räder', npgettext('Car', ['wheel', 'wheels'], 2)
|
91
|
+
assert_equal 'Rad!', npgettext('New car', ['wheel', 'wheels'], 1)
|
92
|
+
assert_equal 'Räder!', npgettext('New car', ['wheel', 'wheels'], 2)
|
85
93
|
end
|
86
94
|
|
87
95
|
def test_ngettextpluralizes_entry_with_dots
|
data/test/i18n_test.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# encoding: utf-8
|
1
2
|
require 'test_helper'
|
2
3
|
|
3
4
|
class I18nTest < Test::Unit::TestCase
|
@@ -233,4 +234,21 @@ class I18nTest < Test::Unit::TestCase
|
|
233
234
|
assert_raise(I18n::ArgumentError) { I18n.with_locale(:pl) { raise I18n::ArgumentError } }
|
234
235
|
assert_equal I18n.default_locale, I18n.locale
|
235
236
|
end
|
237
|
+
|
238
|
+
test "I18n.translitarate handles I18n::ArgumentError exception" do
|
239
|
+
I18n::Backend::Transliterator.stubs(:get).raises(I18n::ArgumentError)
|
240
|
+
I18n.exception_handler.expects(:call).raises(I18n::ArgumentError)
|
241
|
+
assert_raise(I18n::ArgumentError) {
|
242
|
+
I18n.transliterate("ąćó")
|
243
|
+
}
|
244
|
+
end
|
245
|
+
|
246
|
+
test "I18n.translitarate raises I18n::ArgumentError exception" do
|
247
|
+
I18n::Backend::Transliterator.stubs(:get).raises(I18n::ArgumentError)
|
248
|
+
I18n.exception_handler.expects(:call).never
|
249
|
+
assert_raise(I18n::ArgumentError) {
|
250
|
+
I18n.transliterate("ąćó", :raise => true)
|
251
|
+
}
|
252
|
+
end
|
253
|
+
|
236
254
|
end
|
@@ -121,4 +121,16 @@ class I18nFallbacksComputationTest < Test::Unit::TestCase
|
|
121
121
|
test "with a mapping :de => :en, :he => :en defined it [:he, :en] for :de" do
|
122
122
|
assert_equal [:he, :"en-US", :en], @fallbacks[:he]
|
123
123
|
end
|
124
|
+
|
125
|
+
# Test allowing mappings that fallback to each other
|
126
|
+
|
127
|
+
test "with :no => :nb, :nb => :no defined :no returns [:no, :nb, :en-US, :en]" do
|
128
|
+
@fallbacks.map(:no => :nb, :nb => :no)
|
129
|
+
assert_equal [:no, :nb, :"en-US", :en], @fallbacks[:no]
|
130
|
+
end
|
131
|
+
|
132
|
+
test "with :no => :nb, :nb => :no defined :nb returns [:nb, :no, :en-US, :en]" do
|
133
|
+
@fallbacks.map(:no => :nb, :nb => :no)
|
134
|
+
assert_equal [:nb, :no, :"en-US", :en], @fallbacks[:nb]
|
135
|
+
end
|
124
136
|
end
|
@@ -42,6 +42,10 @@ msgstr "Modell"
|
|
42
42
|
msgid "Car|Wheels count"
|
43
43
|
msgstr "Räderzahl"
|
44
44
|
|
45
|
+
msgctxt "New car"
|
46
|
+
msgid "Wheels count"
|
47
|
+
msgstr "Räderzahl!"
|
48
|
+
|
45
49
|
#: app/views/cars/show.html.erb:7
|
46
50
|
msgid "Created"
|
47
51
|
msgstr "Erstellt"
|
@@ -66,6 +70,12 @@ msgid_plural "Car|wheels"
|
|
66
70
|
msgstr[0] "Rad"
|
67
71
|
msgstr[1] "Räder"
|
68
72
|
|
73
|
+
msgctxt "New car"
|
74
|
+
msgid "wheel"
|
75
|
+
msgid_plural "wheels"
|
76
|
+
msgstr[0] "Rad!"
|
77
|
+
msgstr[1] "Räder!"
|
78
|
+
|
69
79
|
msgid "On %{count} wheel."
|
70
80
|
msgid_plural "On %{count} wheels."
|
71
81
|
msgstr[0] "Auf %{count} Achse."
|
@@ -1 +0,0 @@
|
|
1
|
-
en:
|
@@ -27,7 +27,7 @@
|
|
27
27
|
:fi => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
28
28
|
:fil => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
29
29
|
:fo => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
30
|
-
:fr => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n && n != 2 ? :one : :other } } } },
|
30
|
+
:fr => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n.between?(0, 2) && n != 2 ? :one : :other } } } },
|
31
31
|
:fur => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
32
32
|
:fy => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
33
33
|
:ga => { :i18n => { :plural => { :keys => [:one, :two, :other], :rule => lambda { |n| n == 1 ? :one : n == 2 ? :two : :other } } } },
|
@@ -74,7 +74,7 @@
|
|
74
74
|
:or => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
75
75
|
:pa => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
76
76
|
:pap => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
77
|
-
:pl => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100)
|
77
|
+
:pl => { :i18n => { :plural => { :keys => [:one, :few, :other], :rule => lambda { |n| n == 1 ? :one : [2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) ? :few : :other } } } },
|
78
78
|
:ps => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
79
79
|
:pt => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| [0, 1].include?(n) ? :one : :other } } } },
|
80
80
|
:"pt-PT" => { :i18n => { :plural => { :keys => [:one, :other], :rule => lambda { |n| n == 1 ? :one : :other } } } },
|
metadata
CHANGED
@@ -1,15 +1,10 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: i18n
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.1
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 6
|
9
|
-
- 0
|
10
|
-
version: 0.6.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Sven Fuchs
|
14
9
|
- Joshua Harvey
|
15
10
|
- Matt Aimonetti
|
@@ -18,77 +13,78 @@ authors:
|
|
18
13
|
autorequire:
|
19
14
|
bindir: bin
|
20
15
|
cert_chain: []
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
dependencies:
|
25
|
-
- !ruby/object:Gem::Dependency
|
16
|
+
date: 2012-08-31 00:00:00.000000000 Z
|
17
|
+
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
26
19
|
name: activesupport
|
27
|
-
|
28
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
20
|
+
requirement: !ruby/object:Gem::Requirement
|
29
21
|
none: false
|
30
|
-
requirements:
|
22
|
+
requirements:
|
31
23
|
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
hash: 7
|
34
|
-
segments:
|
35
|
-
- 3
|
36
|
-
- 0
|
37
|
-
- 0
|
24
|
+
- !ruby/object:Gem::Version
|
38
25
|
version: 3.0.0
|
39
26
|
type: :development
|
40
|
-
version_requirements: *id001
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: sqlite3
|
43
27
|
prerelease: false
|
44
|
-
|
28
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
29
|
none: false
|
46
|
-
requirements:
|
47
|
-
- -
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 3.0.0
|
34
|
+
- !ruby/object:Gem::Dependency
|
35
|
+
name: sqlite3
|
36
|
+
requirement: !ruby/object:Gem::Requirement
|
37
|
+
none: false
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
53
42
|
type: :development
|
54
|
-
version_requirements: *id002
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: mocha
|
57
43
|
prerelease: false
|
58
|
-
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
45
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: mocha
|
52
|
+
requirement: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
67
58
|
type: :development
|
68
|
-
version_requirements: *id003
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: test_declarative
|
71
59
|
prerelease: false
|
72
|
-
|
60
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
61
|
none: false
|
74
|
-
requirements:
|
75
|
-
- -
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
- !ruby/object:Gem::Dependency
|
67
|
+
name: test_declarative
|
68
|
+
requirement: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
81
74
|
type: :development
|
82
|
-
|
75
|
+
prerelease: false
|
76
|
+
version_requirements: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
83
82
|
description: New wave Internationalization support for Ruby.
|
84
83
|
email: rails-i18n@googlegroups.com
|
85
84
|
executables: []
|
86
|
-
|
87
85
|
extensions: []
|
88
|
-
|
89
86
|
extra_rdoc_files: []
|
90
|
-
|
91
|
-
files:
|
87
|
+
files:
|
92
88
|
- ci/Gemfile.no-rails
|
93
89
|
- ci/Gemfile.no-rails.lock
|
94
90
|
- ci/Gemfile.rails-2.3.x
|
@@ -147,6 +143,7 @@ files:
|
|
147
143
|
- test/api/fallbacks_test.rb
|
148
144
|
- test/api/key_value_test.rb
|
149
145
|
- test/api/memoize_test.rb
|
146
|
+
- test/api/override_test.rb
|
150
147
|
- test/api/pluralization_test.rb
|
151
148
|
- test/api/simple_test.rb
|
152
149
|
- test/backend/cache_test.rb
|
@@ -182,41 +179,29 @@ files:
|
|
182
179
|
- README.textile
|
183
180
|
- MIT-LICENSE
|
184
181
|
- CHANGELOG.textile
|
185
|
-
has_rdoc: true
|
186
182
|
homepage: http://github.com/svenfuchs/i18n
|
187
183
|
licenses: []
|
188
|
-
|
189
184
|
post_install_message:
|
190
185
|
rdoc_options: []
|
191
|
-
|
192
|
-
require_paths:
|
186
|
+
require_paths:
|
193
187
|
- lib
|
194
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
195
189
|
none: false
|
196
|
-
requirements:
|
197
|
-
- -
|
198
|
-
- !ruby/object:Gem::Version
|
199
|
-
|
200
|
-
|
201
|
-
- 0
|
202
|
-
version: "0"
|
203
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ! '>='
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
204
195
|
none: false
|
205
|
-
requirements:
|
206
|
-
- -
|
207
|
-
- !ruby/object:Gem::Version
|
208
|
-
hash: 17
|
209
|
-
segments:
|
210
|
-
- 1
|
211
|
-
- 3
|
212
|
-
- 5
|
196
|
+
requirements:
|
197
|
+
- - ! '>='
|
198
|
+
- !ruby/object:Gem::Version
|
213
199
|
version: 1.3.5
|
214
200
|
requirements: []
|
215
|
-
|
216
|
-
|
217
|
-
rubygems_version: 1.4.2
|
201
|
+
rubyforge_project: ! '[none]'
|
202
|
+
rubygems_version: 1.8.23
|
218
203
|
signing_key:
|
219
204
|
specification_version: 3
|
220
205
|
summary: New wave Internationalization support for Ruby
|
221
206
|
test_files: []
|
222
|
-
|
207
|
+
has_rdoc:
|