Permalink
Browse files

removed #populate and #store_translations from API

  • Loading branch information...
1 parent dd76298 commit f4e514a80be7feb509f66824ee311905e2940900 @mseppae mseppae committed with Sven Fuchs Aug 27, 2008
Showing with 5 additions and 33 deletions.
  1. +0 −12 lib/i18n.rb
  2. +4 −4 test/i18n_exceptions_test.rb
  3. +1 −17 test/i18n_test.rb
View
@@ -49,13 +49,6 @@ def exception_handler=(exception_handler)
@@exception_handler = exception_handler
end
- # Allow client libraries to pass a block that populates the translation
- # storage. Decoupled for backends like a db backend that persist their
- # translations, so the backend can decide whether/when to yield or not.
- def populate(&block)
- backend.populate(&block)
- end
-
# Allows client libraries to pass arguments that specify a source for
# translation data to be loaded by the backend. The backend defines
# acceptable sources.
@@ -66,11 +59,6 @@ def load_translations(*args)
backend.load_translations(*args)
end
- # Stores translations for the given locale in the backend.
- def store_translations(locale, data)
- backend.store_translations locale, data
- end
-
# Translates, pluralizes and interpolates a given key using a given locale,
# scope, and default, as well as interpolation values.
#
@@ -79,22 +79,22 @@ def force_invalid_locale
end
def force_missing_translation_data
- I18n.store_translations 'de-DE', :bar => nil
+ I18n.backend.store_translations 'de-DE', :bar => nil
I18n.backend.translate 'de-DE', :foo, :scope => :bar
end
def force_invalid_pluralization_data
- I18n.store_translations 'de-DE', :foo => [:bar]
+ I18n.backend.store_translations 'de-DE', :foo => [:bar]
I18n.backend.translate 'de-DE', :foo, :count => 1
end
def force_missing_interpolation_argument
- I18n.store_translations 'de-DE', :foo => "{{bar}}"
+ I18n.backend.store_translations 'de-DE', :foo => "{{bar}}"
I18n.backend.translate 'de-DE', :foo, :baz => 'baz'
end
def force_reserved_interpolation_key
- I18n.store_translations 'de-DE', :foo => "{{scope}}"
+ I18n.backend.store_translations 'de-DE', :foo => "{{scope}}"
I18n.backend.translate 'de-DE', :foo, :baz => 'baz'
end
end
View
@@ -8,7 +8,7 @@
class I18nTest < Test::Unit::TestCase
def setup
- I18n.store_translations :'en-US', {
+ I18n.backend.store_translations :'en-US', {
:currency => {
:format => {
:separator => '.',
@@ -71,22 +71,6 @@ def test_delegates_localize_to_backend
I18n.localize :whatever, :locale => 'de-DE'
end
- def test_delegates_store_translations_to_backend
- I18n.backend.expects(:store_translations).with 'de-DE', {:foo => :bar}
- I18n.store_translations 'de-DE', {:foo => :bar}
- end
-
- def test_delegates_populate_to_backend
- I18n.backend.expects(:populate) # can't specify a block here as an expected argument
- I18n.populate{ }
- end
-
- def test_populate_yields_the_block
- tmp = nil
- I18n.populate do tmp = 'yielded' end
- assert_equal 'yielded', tmp
- end
-
def test_translate_given_no_locale_uses_i18n_locale
I18n.backend.expects(:translate).with 'en-US', :foo, {}
I18n.translate :foo

0 comments on commit f4e514a

Please sign in to comment.