From 2e13fc10e5ec62a1f085c113526474c3360bb041 Mon Sep 17 00:00:00 2001 From: Rany Keddo Date: Wed, 25 Nov 2009 14:36:50 +0100 Subject: [PATCH] fixed active_record_missing mixin, now uses new i18n.plural.keys namespace --- lib/i18n/backend/active_record/missing.rb | 10 ++++++---- test/cases/backend/active_record/missing_test.rb | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/i18n/backend/active_record/missing.rb b/lib/i18n/backend/active_record/missing.rb index 266f731d..481cd763 100644 --- a/lib/i18n/backend/active_record/missing.rb +++ b/lib/i18n/backend/active_record/missing.rb @@ -11,19 +11,21 @@ # I18n.backend = I18nChainBackend.new(I18n::Backend::ActiveRecord.new, I18n::Backend::Simple.new) # # Stub records for pluralizations will also be created for each key defined -# in i18n.plural_keys. +# in i18n.plural.keys. # # For example: # # # en.yml # en: # i18n: -# plural_keys: [:zero, :one, :other] +# plural: +# keys: [:zero, :one, :other] # # # pl.yml # pl: # i18n: -# plural_keys: [:zero, :one, :few, :other] +# plural: +# keys: [:zero, :one, :few, :other] # # It will also persist interpolation keys in Translation#interpolations so # translators will be able to review and use them. @@ -40,7 +42,7 @@ def store_default_translations(locale, key, options = {}) unless ActiveRecord::Translation.locale(locale).lookup(key, separator).exists? interpolations = options.reject { |name, value| Base::RESERVED_KEYS.include?(name) }.keys - keys = count ? I18n.t('i18n.plural_keys', :locale => locale).map { |k| [key, k].join(separator) } : [key] + keys = count ? I18n.t('i18n.plural.keys', :locale => locale).map { |k| [key, k].join(separator) } : [key] keys.each { |key| store_default_translation(locale, key, interpolations) } end end diff --git a/test/cases/backend/active_record/missing_test.rb b/test/cases/backend/active_record/missing_test.rb index 3c7418d5..395ae3c3 100644 --- a/test/cases/backend/active_record/missing_test.rb +++ b/test/cases/backend/active_record/missing_test.rb @@ -5,7 +5,7 @@ class I18nActiveRecordMissingTest < Test::Unit::TestCase def setup - store_translations(:en, :i18n => { :plural_keys => [:zero, :one, :other] }) + store_translations(:en, :i18n => { :plural => { :keys => [:zero, :one, :other] } }) I18n.backend = I18n::Backend::Chain.new(I18n.backend) I18n.backend.meta_class.send(:include, I18n::Backend::ActiveRecord::Missing)