From f4e514a80be7feb509f66824ee311905e2940900 Mon Sep 17 00:00:00 2001 From: Marko Seppae Date: Wed, 27 Aug 2008 09:37:32 +0200 Subject: [PATCH] removed #populate and #store_translations from API --- lib/i18n.rb | 12 ------------ test/i18n_exceptions_test.rb | 8 ++++---- test/i18n_test.rb | 18 +----------------- 3 files changed, 5 insertions(+), 33 deletions(-) diff --git a/lib/i18n.rb b/lib/i18n.rb index 9e347d94..0988ea8f 100755 --- a/lib/i18n.rb +++ b/lib/i18n.rb @@ -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. # diff --git a/test/i18n_exceptions_test.rb b/test/i18n_exceptions_test.rb index 1ea16016..f5d76bfe 100644 --- a/test/i18n_exceptions_test.rb +++ b/test/i18n_exceptions_test.rb @@ -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 \ No newline at end of file diff --git a/test/i18n_test.rb b/test/i18n_test.rb index 69ae7df1..96f1d5f3 100644 --- a/test/i18n_test.rb +++ b/test/i18n_test.rb @@ -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