diff --git a/lib/liquid/template.rb b/lib/liquid/template.rb index 1a6dc01..3e62765 100644 --- a/lib/liquid/template.rb +++ b/lib/liquid/template.rb @@ -61,8 +61,7 @@ module Liquid end # creates a new Template from an array of tokens. Use Template.parse instead - def initialize(options = {}) - registers[:locale] = I18n.new(options[:locale]) || I18n.new + def initialize @resource_limits = {} end @@ -80,7 +79,7 @@ module Liquid end def registers - @registers ||= {} + @registers ||= {:locale => Liquid::I18n.new} end def assigns diff --git a/test/liquid/template_test.rb b/test/liquid/template_test.rb index 40ee971..8f3a6fc 100644 --- a/test/liquid/template_test.rb +++ b/test/liquid/template_test.rb @@ -145,14 +145,14 @@ class TemplateTest < Test::Unit::TestCase end def test_sets_default_localization_in_context - t = Template.new(:locale => fixture("en_locale.yml")) - + t = Template.new assert_instance_of I18n, t.registers[:locale] - assert_equal fixture("en_locale.yml"), t.registers[:locale].path end def test_sets_default_localization_in_context_with_quick_initialization - t = Template.parse('{{foo}}', :locale => fixture("en_locale.yml")) + t = Template.new + t.registers[:locale] = I18n.new(fixture("en_locale.yml")) + t.parse('{{foo}}') assert_instance_of I18n, t.registers[:locale] assert_equal fixture("en_locale.yml"), t.registers[:locale].path